008_quiz.patch 956 B

123456789101112131415161718192021222324252627282930
  1. --- exercises/008_quiz.zig 2023-10-03 22:15:22.122241138 +0200
  2. +++ answers/008_quiz.zig 2023-10-05 20:04:06.879430240 +0200
  3. @@ -19,11 +19,11 @@
  4. // the idiomatic type to use for array indexing.
  5. //
  6. // There IS a problem on this line, but 'usize' isn't it.
  7. - const x: usize = 1;
  8. + var x: usize = 1;
  9. // Note: When you want to declare memory (an array in this
  10. // case) without putting anything in it, you can set it to
  11. - // 'undefined'. There is no problem on this line.
  12. + // 'undefined'. There is no error here.
  13. var lang: [3]u8 = undefined;
  14. // The following lines attempt to put 'Z', 'i', and 'g' into the
  15. @@ -33,10 +33,10 @@
  16. lang[0] = letters[x];
  17. x = 3;
  18. - lang[???] = letters[x];
  19. + lang[1] = letters[x];
  20. - x = ???;
  21. - lang[2] = letters[???];
  22. + x = 5;
  23. + lang[2] = letters[x];
  24. // We want to "Program in Zig!" of course:
  25. std.debug.print("Program in {s}!\n", .{lang});