Examveda

What is the output of the given code?
string = gets.chomp
case string
when string = "a"
print "alphabet a"
when string = "b"
print "alphabet b"
when string = "c"
print "alphabet c"
else 
    print "some other alphabet"
end

A. alphabet a

B. b
alphabet b

C. alphabet c

D. Syntax error

Answer: Option B


This Question Belongs to Ruby Programming >> Control Structures In Ruby

Join The Discussion

Related Questions on Control Structures in Ruby