Ruby - Control Flow
Given this Ruby code, what will be the output?
data = [3, 7, 12, 18] case data in [Integer, Integer, Integer, Integer] puts "All integers" in [Integer, Integer, Integer, 18] puts "Last is 18" else puts "No match" end
Given this Ruby code, what will be the output?
data = [3, 7, 12, 18] case data in [Integer, Integer, Integer, Integer] puts "All integers" in [Integer, Integer, Integer, 18] puts "Last is 18" else puts "No match" end
case checks patterns in order. The first pattern matches any array of four integers.data matches first pattern15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions