update switch docs

This commit is contained in:
leaf corcoran 2013-01-24 18:44:14 -08:00
parent 7c4cd41fba
commit 05f6a0b7f7

View File

@ -696,12 +696,15 @@ is done with the `==` operator.
switch name switch name
when "Robert" when "Robert"
print "You are robert" print "You are robert"
when "Dan" when "Dan", "Daniel"
print "Your name, it's Dan" print "Your name, it's Dan"
else else
print "I don't know about your name" print "I don't know about your name"
``` ```
A switch `when` clause can match against multiple values by listing them out
comma separated.
Switches can be used as expressions as well, here we can assign the result of Switches can be used as expressions as well, here we can assign the result of
the switch to a variable: the switch to a variable: