Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import SwitchExpression from "!!raw-loader!./09.switch-expression.zig";
# Switch

Zig's `switch` works as both a statement and an expression. The types of all
branches must coerce to the type which is being switched upon. All possible
values must have an associated branch - values cannot be left out. Cases cannot
fall through to other branches.
branches must coerce to the same type. All possible values must have an
associated branch - values cannot be left out. Cases cannot fall through to
other branches.

An example of a switch statement. The else is required to satisfy the
exhaustiveness of this switch.
Expand Down