Skip to content

Commit

Permalink
Demonstrate @switch with multiline block
Browse files Browse the repository at this point in the history
  • Loading branch information
jariji authored Feb 16, 2024
1 parent fb9c79a commit 617f345
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions docs/syntax/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,12 @@ julia> x = (33, 44)
(33, 44)
julia> @switch x begin
@case (var, _)
println(var)
end
33
julia> var
33
julia> @switch 1 begin
@case (var, _)
println(var)
end
ERROR: matching non-exhaustive, at #= REPL[25]:1 =#
@case (a::Float64, _)
print(a)
println(" float")
@case (a::Int64, _)
print(a)
println(" int")
end
33 int
```

0 comments on commit 617f345

Please sign in to comment.