Skip to content

Clarify swtich type rules#349

Open
Blond11516 wants to merge 1 commit into
Sobeston:masterfrom
Blond11516:patch-1
Open

Clarify swtich type rules#349
Blond11516 wants to merge 1 commit into
Sobeston:masterfrom
Blond11516:patch-1

Conversation

@Blond11516

Copy link
Copy Markdown

Take the following example:

const x: u8 = 1;
switch (x) {
    1 => "hello",
    else => "world!",
};

To me, the "type which is being switched upon" sounds like the type of x, which is u8. The current text makes me think that the switch expression must also return a u8, which isn't the case.

Take the following example:
```zig
const x: u8 = 1;
switch (x) {
    1 => "hello",
    else => "world!",
};
```

To me, the "type which is being switched upon" sounds like the type of x, which is u8. The current text makes me think that the switch expression must also return a u8, which isn't the case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant