You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Chapters/03-structs.qmd
+39-3
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,9 @@ pub fn main() !void {
149
149
}
150
150
```
151
151
152
+
153
+
#### Switch statements exhaust all possibilities
154
+
152
155
Now, one very important aspect about this switch statement presented
153
156
in the code example above, is that it exhaust all existing possibilities.
154
157
In other words, all possible values that could be found inside the `order`
@@ -165,12 +168,17 @@ a switch statement, and leave an edge case with no expliciting action to be take
165
168
This is a similar behaviour to switch statements in Rust, which also have to
166
169
handle all possible cases.
167
170
171
+
172
+
173
+
#### The else branch
174
+
168
175
Take a look at the `dump_hex_fallible()` function below as an example. This function
169
-
also comes from the Zig Standard Library, but this time, it comes from the [`debug.zig` module](https://github.com/ziglang/zig/blob/master/lib/std/debug.zig)[^debug-mod].
176
+
also comes from the Zig Standard Library, but this time, it comes from the
0 commit comments