0
Case
Can a case function take an expression such as string.include?() == true
1 Antwort
+ 2
According to
http://ruby-doc.com/docs/ProgrammingRuby/html/tut_expressions.html#S5
Switch structures in Ruby are basically "multiway ifs on steriods", and doesn't mention restrictions on switching certain data types. I'd expect it to work and surely,
case "bygone".include?"by"
when true
puts "yes"
when false
puts "no"
end
works fine.