Ruby - Control Flow
Which of the following is the correct syntax to match a number n in the range 5 to 15 inside a case statement using pattern matching?
case n
in ???
puts "In range"
else
puts "Out of range"
endWhich of the following is the correct syntax to match a number n in the range 5 to 15 inside a case statement using pattern matching?
case n
in ???
puts "In range"
else
puts "Out of range"
endin clausecase, in is followed directly by the pattern, so in 5..15 is correct syntax.in or with extra parentheses are invalid syntax in this context.in followed by the pattern without extra keywords or parentheses [OK]in once, then the pattern without extra keywords [OK]in in 5..15 which is invalid5...15 which excludes 1515+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions