From 617f345c622655f2012a629cddf3bee2548afd4e Mon Sep 17 00:00:00 2001 From: jariji <96840304+jariji@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:05:08 -0800 Subject: [PATCH] Demonstrate `@switch` with multiline block --- docs/syntax/switch.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/docs/syntax/switch.md b/docs/syntax/switch.md index f1a6eb1..6aa8e99 100644 --- a/docs/syntax/switch.md +++ b/docs/syntax/switch.md @@ -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 ```