Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the output of the given code?
age = 4
case age
puts “baby” when 0 .. 2
puts “little child” when 3 .. 6
puts “child” when 7 .. 12
puts “youth” when 13 .. 18
puts “adult” else
end

What is the output of the given code?
age = 4
case age
puts “baby” when 0 .. 2
puts “little child” when 3 .. 6
puts “child” when 7 .. 12
puts “youth” when 13 .. 18
puts “adult” else
end
a) adult
b) youth
c) child
d) syntax error

Answer: d
Explanation: The following code will give the error because the syntax is not similar to case statements syntax.

Join The Discussion