+ 1
Please explain me this code!!
name = 'Fisher' case name when /fish/i then puts "Something is fishy here" when 'Smith' then puts "Your name is Smith" end #=> Something is fishy here i don't understand when /fish/i then puts "Something is fishy here" Thanks
2 Answers
+ 11
When you do:
case name
The program inspects the string stored in variable name to find if:
/fish/i
In the sense that the string contains a sequence of characters which form the string "fish". If it does, then:
puts "Something is fishy here"
Hence the program outputs the result.
+ 2
thanks i got it !!
/fish/i it s call regular expression?