diff options
| author | Nuno Mendes <98030270+nm-remarkable@users.noreply.github.com> | 2024-09-16 18:38:43 +0200 |
|---|---|---|
| committer | Nuno Mendes <98030270+nm-remarkable@users.noreply.github.com> | 2024-09-16 18:39:54 +0200 |
| commit | db569a1478d11c1014ce9569ad65fc5cea9a09c9 (patch) | |
| tree | 47b894997211242954d20e545dc7cf3fddffbe68 /patches | |
| parent | 798bb403963f15028db7d0325d93ab1af6dde684 (diff) | |
update labeled switch to also have a break statement
Diffstat (limited to 'patches')
| -rw-r--r-- | patches/patches/108_labeled_switch.patch | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/patches/patches/108_labeled_switch.patch b/patches/patches/108_labeled_switch.patch index dfb65dd..230b8fb 100644 --- a/patches/patches/108_labeled_switch.patch +++ b/patches/patches/108_labeled_switch.patch @@ -1,11 +1,18 @@ --- a/exercises/108_labeled_switch.zig +++ b/exercises/108_labeled_switch.zig -@@ -26,7 +26,7 @@ pub fn main() void { - // try to fix it! +@@ -26,13 +26,13 @@ pub fn main() void { + // how would you fix it? pr: switch (@as(PullRequestState, PullRequestState.Draft)) { PullRequestState.Draft => continue :pr PullRequestState.InReview, - PullRequestState.InReview => continue :pr PullRequestState.Rejected, + PullRequestState.InReview => continue :pr PullRequestState.Approved, PullRequestState.Approved => continue :pr PullRequestState.Merged, - PullRequestState.Rejected => std.debug.print("The pull request has been rejected", .{}), - PullRequestState.Merged => std.debug.print("The pull request has been merged", .{}), + PullRequestState.Rejected => { + std.debug.print("The pull request has been rejected", .{}); + return; + }, +- PullRequestState.Merged => break, // Would you know where to break to? ++ PullRequestState.Merged => break :pr, // Would you know where to break to? + } + std.debug.print("The pull request has been merged", .{}); + } |
