Skip to content

Commit 05f6a0b

Browse files
committed
update switch docs
1 parent 7c4cd41 commit 05f6a0b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/reference.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,15 @@ is done with the `==` operator.
696696
switch name
697697
when "Robert"
698698
print "You are robert"
699-
when "Dan"
699+
when "Dan", "Daniel"
700700
print "Your name, it's Dan"
701701
else
702702
print "I don't know about your name"
703703
```
704704

705+
A switch `when` clause can match against multiple values by listing them out
706+
comma separated.
707+
705708
Switches can be used as expressions as well, here we can assign the result of
706709
the switch to a variable:
707710

0 commit comments

Comments
 (0)