Files
ziglings/patches/patches/006_strings.patch
2026-05-04 17:15:30 +02:00

20 lines
721 B
Diff

--- exercises/006_strings.zig 2026-05-04 17:04:31.763821070 +0200
+++ answers/006_strings.zig 2026-05-04 17:02:11.672866263 +0200
@@ -24,14 +24,14 @@
// (Problem 1)
// Use array square bracket syntax to get the letter 'd' from
// the string "stardust" above.
- const d: u8 = ziggy[???];
+ const d: u8 = ziggy[4];
// (Problem 2)
// Use the array concatenation '++' operator to make "Major Tom".
// (You'll need to add a space as well!)
const major = "Major";
const tom = "Tom";
- const major_tom = major ??? tom;
+ const major_tom = major ++ " " ++ tom;
// That's all the problems. Let's see our results:
std.debug.print("d={u} {s}\n", .{ d, major_tom });