2009-12-24 04:33:59 -05:00
|
|
|
num: 10
|
|
|
|
|
|
|
|
result: switch num
|
2009-12-28 23:08:02 -05:00
|
|
|
when 5 then false
|
|
|
|
when 'a'
|
|
|
|
true
|
|
|
|
true
|
|
|
|
false
|
|
|
|
when 10 then true
|
2010-01-09 13:25:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
# Mid-switch comment with whitespace
|
|
|
|
# and multi line
|
2009-12-28 23:08:02 -05:00
|
|
|
when 11 then false
|
|
|
|
else false
|
2010-01-09 13:25:44 -05:00
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts result
|
2010-01-13 19:56:35 -05:00
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
func: (num) ->
|
2010-01-13 19:56:35 -05:00
|
|
|
switch num
|
|
|
|
when 2, 4, 6
|
|
|
|
true
|
|
|
|
when 1, 3, 5
|
|
|
|
false
|
|
|
|
else false
|
|
|
|
|
2010-01-29 23:30:54 -05:00
|
|
|
puts func(2)
|
|
|
|
puts func(6)
|
|
|
|
puts !func(3)
|
|
|
|
puts !func(8)
|