Andrew Briening

Cultivating Business With Technology

Ruby Case Statement Without Arguments

1
2
3
4
5
6
7
8
9
10
11
12
def some_method
  false
end

case
when false, nil
   puts "won't print"
when some_method
  puts "still won't print"
when true, or_other_method_that_is_trueish
  puts "There you go."
end

Cool.