Discussion :: Ruby Programming MCQs
-
What is the output of the given code?string = gets.chompcase stringwhen string = "a"print "alphabet a"when string = "b"print "alphabet b"when string = "c"print "alphabet c"elseprint "some other alphabet"end
Answer : Option B
Explanation :
After taking input from the user will check which string is entered and goes to particular case statement. Output: b alphabet b
Be The First To Comment