This commit is contained in:
Armin Friedl 2025-01-18 15:31:54 +01:00
parent 17c5f932f1
commit 5ff6e7ed86

View file

@ -24,18 +24,18 @@ pub fn main() void {
// (Problem 1) // (Problem 1)
// Use array square bracket syntax to get the letter 'd' from // Use array square bracket syntax to get the letter 'd' from
// the string "stardust" above. // the string "stardust" above.
const d: u8 = ziggy[???]; const d: u8 = ziggy[4];
// (Problem 2) // (Problem 2)
// Use the array repeat '**' operator to make "ha ha ha ". // Use the array repeat '**' operator to make "ha ha ha ".
const laugh = "ha " ???; const laugh = "ha " ** 3;
// (Problem 3) // (Problem 3)
// Use the array concatenation '++' operator to make "Major Tom". // Use the array concatenation '++' operator to make "Major Tom".
// (You'll need to add a space as well!) // (You'll need to add a space as well!)
const major = "Major"; const major = "Major";
const tom = "Tom"; const tom = "Tom";
const major_tom = major ??? tom; const major_tom = major ++ " " ++ tom;
// That's all the problems. Let's see our results: // That's all the problems. Let's see our results:
std.debug.print("d={u} {s}{s}\n", .{ d, laugh, major_tom }); std.debug.print("d={u} {s}{s}\n", .{ d, laugh, major_tom });