diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/patches/006_strings.patch | 6 | ||||
-rw-r--r-- | patches/patches/008_quiz.patch | 14 | ||||
-rw-r--r-- | patches/patches/036_enums2.patch | 6 | ||||
-rw-r--r-- | patches/patches/051_values.patch | 6 | ||||
-rw-r--r-- | patches/patches/052_slices.patch | 4 | ||||
-rw-r--r-- | patches/patches/054_manypointers.patch | 2 | ||||
-rw-r--r-- | patches/patches/063_labels.patch | 44 | ||||
-rw-r--r-- | patches/patches/076_sentinels.patch | 4 |
8 files changed, 66 insertions, 20 deletions
diff --git a/patches/patches/006_strings.patch b/patches/patches/006_strings.patch index 040a73c..7e7465c 100644 --- a/patches/patches/006_strings.patch +++ b/patches/patches/006_strings.patch @@ -1,12 +1,12 @@ -22c22 +25c25 < const d: u8 = ziggy[???]; --- > const d: u8 = ziggy[4]; -26c26 +29c29 < const laugh = "ha " ???; --- > const laugh = "ha " ** 3; -33c33 +36c36 < const major_tom = major ??? tom; --- > const major_tom = major ++ " " ++ tom; diff --git a/patches/patches/008_quiz.patch b/patches/patches/008_quiz.patch index 3d35a5a..a62be07 100644 --- a/patches/patches/008_quiz.patch +++ b/patches/patches/008_quiz.patch @@ -1,12 +1,16 @@ -16c16 -< const x: u8 = 1; +22c22 +< const x: usize = 1; --- -> var x: u8 = 1; -27c27 +> var x: usize = 1; +26c26 +< // 'undefined'. There is no problem on this line. +--- +> // 'undefined'. There is no error here. +36c36 < lang[???] = letters[x]; --- > lang[1] = letters[x]; -29,30c29,30 +38,39c38,39 < x = ???; < lang[2] = letters[???]; --- diff --git a/patches/patches/036_enums2.patch b/patches/patches/036_enums2.patch index 54a7094..c20905a 100644 --- a/patches/patches/036_enums2.patch +++ b/patches/patches/036_enums2.patch @@ -1,12 +1,12 @@ -32c32 +34c34 < blue = ???, --- > blue = 0x0000ff, -54c54 +56c56 < \\ <span style="color: #{}">Blue</span> --- > \\ <span style="color: #{x:0>6}">Blue</span> -59c59 +62c62 < @enumToInt(???), // Oops! We're missing something! --- > @enumToInt(Color.blue), // Oops! We're missing something! diff --git a/patches/patches/051_values.patch b/patches/patches/051_values.patch index 43d1f65..6d3c53b 100644 --- a/patches/patches/051_values.patch +++ b/patches/patches/051_values.patch @@ -1,12 +1,12 @@ -96c96 +95c95 < const print = ???; --- > const print = std.debug.print; -152c152 +160c160 < levelUp(glorp, reward_xp); --- > levelUp(&glorp, reward_xp); -157c157 +166c166 < fn levelUp(character_access: Character, xp: u32) void { --- > fn levelUp(character_access: *Character, xp: u32) void { diff --git a/patches/patches/052_slices.patch b/patches/patches/052_slices.patch index 80f8d72..24803d7 100644 --- a/patches/patches/052_slices.patch +++ b/patches/patches/052_slices.patch @@ -1,10 +1,10 @@ -34,35c34,35 +35,36c35,36 < const hand1: []u8 = cards[???]; < const hand2: []u8 = cards[???]; --- > const hand1: []u8 = cards[0..4]; > const hand2: []u8 = cards[4..]; -45c45 +46c46 < fn printHand(hand: ???) void { --- > fn printHand(hand: []u8) void { diff --git a/patches/patches/054_manypointers.patch b/patches/patches/054_manypointers.patch index 82824e8..d8d2e6c 100644 --- a/patches/patches/054_manypointers.patch +++ b/patches/patches/054_manypointers.patch @@ -1,4 +1,4 @@ -33c33 +35c35 < const zen12_string: []const u8 = zen_manyptr; --- > const zen12_string: []const u8 = zen_manyptr[0..21]; diff --git a/patches/patches/063_labels.patch b/patches/patches/063_labels.patch index 2f54a43..aba02a4 100644 --- a/patches/patches/063_labels.patch +++ b/patches/patches/063_labels.patch @@ -1,4 +1,46 @@ -132,133c131,132 +20c20 +< // statement. Does that mean you can return a value from any +--- +> // statement. Does that mean you can return a value from any +28,30c28,30 +< // Labels can also be used with loops. Being able to break out of +< // nested loops at a specific level is one of those things that +< // you won't use every day, but when the time comes, it's +--- +> // And all of that also applies to loops. Being able to break out +> // of nested loops at a specific level is one of those things +> // that you won't use every day, but when the time comes, it's +32,33c32 +< // inner loop is sometimes so handy, it almost feels like cheating +< // (and can help you avoid creating a lot of temporary variables). +--- +> // inner loop is is almost too beautiful to look at directly: +41,44c40,44 +< // In the above example, the break exits from the outer loop +< // labeled "two_loop" and returns the value 2. The else clause is +< // attached to the outer two_loop and would be evaluated if the +< // loop somehow ended without the break having been called. +--- +> // The break exits from the outer loop labeled "two_loop" and +> // returns the value 2. The else clause is attached to the outer +> // two_loop and would be evaluated if the loop somehow ended +> // without the break having been called. (Impossible in this +> // case.) +55,56c55,56 +< // As mentioned before, we'll soon understand why these two +< // numbers don't need explicit types. Hang in there! +--- +> // As mentioned before, we'll soon understand why these numbers +> // don't need explicit types. Hang in there! +100c100 +< // numbers (based on array position) will be fine for our +--- +> // numbers (based on array position!) will be fine for our +108c108 +< // Now look at each required ingredient for the Food... +--- +> // Now look at each required ingredient for the food... +131,132c131,132 < break; < }; --- diff --git a/patches/patches/076_sentinels.patch b/patches/patches/076_sentinels.patch index 33e4483..5c757aa 100644 --- a/patches/patches/076_sentinels.patch +++ b/patches/patches/076_sentinels.patch @@ -1,8 +1,8 @@ -83c83 +86c86 < for (???) |s| { --- > for (my_seq) |s| { -95c95 +98c98 < while (??? != my_sentinel) { --- > while (my_seq[i] != my_sentinel) { |