mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-01-28 01:16:02 +00:00
30 lines
956 B
Diff
30 lines
956 B
Diff
--- exercises/008_quiz.zig 2023-10-03 22:15:22.122241138 +0200
|
|
+++ answers/008_quiz.zig 2023-10-05 20:04:06.879430240 +0200
|
|
@@ -19,11 +19,11 @@
|
|
// the idiomatic type to use for array indexing.
|
|
//
|
|
// There IS a problem on this line, but 'usize' isn't it.
|
|
- const x: usize = 1;
|
|
+ var x: usize = 1;
|
|
|
|
// Note: When you want to declare memory (an array in this
|
|
// case) without putting anything in it, you can set it to
|
|
- // 'undefined'. There is no problem on this line.
|
|
+ // 'undefined'. There is no error here.
|
|
var lang: [3]u8 = undefined;
|
|
|
|
// The following lines attempt to put 'Z', 'i', and 'g' into the
|
|
@@ -33,10 +33,10 @@
|
|
lang[0] = letters[x];
|
|
|
|
x = 3;
|
|
- lang[???] = letters[x];
|
|
+ lang[1] = letters[x];
|
|
|
|
- x = ???;
|
|
- lang[2] = letters[???];
|
|
+ x = 5;
|
|
+ lang[2] = letters[x];
|
|
|
|
// We want to "Program in Zig!" of course:
|
|
std.debug.print("Program in {s}!\n", .{lang});
|