2009-12-24 09:33:59 +00:00
|
|
|
num: 10
|
|
|
|
|
|
|
|
result: switch num
|
2009-12-29 04:08:02 +00:00
|
|
|
when 5 then false
|
|
|
|
when 'a'
|
|
|
|
true
|
|
|
|
true
|
|
|
|
false
|
|
|
|
when 10 then true
|
2010-01-09 18:25:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Mid-switch comment with whitespace
|
|
|
|
# and multi line
|
2009-12-29 04:08:02 +00:00
|
|
|
when 11 then false
|
|
|
|
else false
|
2010-01-09 18:25:44 +00:00
|
|
|
|
2010-01-25 04:40:45 +00:00
|
|
|
print result
|
2010-01-14 00:56:35 +00:00
|
|
|
|
|
|
|
func: num =>
|
|
|
|
switch num
|
|
|
|
when 2, 4, 6
|
|
|
|
true
|
|
|
|
when 1, 3, 5
|
|
|
|
false
|
|
|
|
else false
|
|
|
|
|
2010-01-25 04:40:45 +00:00
|
|
|
print func(2)
|
|
|
|
print func(6)
|
|
|
|
print !func(3)
|
|
|
|
print !func(8)
|