016_for2.patch 522 B

1234567891011
  1. --- exercises/016_for2.zig 2023-10-03 22:15:22.122241138 +0200
  2. +++ answers/016_for2.zig 2023-10-05 20:04:06.912764197 +0200
  3. @@ -25,7 +25,7 @@
  4. // the value of the place as a power of two for each bit.
  5. //
  6. // See if you can figure out the missing pieces:
  7. - for (bits, ???) |bit, ???| {
  8. + for (bits, 0..) |bit, i| {
  9. // Note that we convert the usize i to a u32 with
  10. // @intCast(), a builtin function just like @import().
  11. // We'll learn about these properly in a later exercise.