Y

Yatendra Sir • 5.66K Points
Tutor III

Q. What will be output for the following code When input number is ""!""?

Code:
def catch_and_throw(value)

puts value
a = readline.chomp

throw :value_e if a == ""!""
return a

end

catch :value_e do

number = catch_and_throw(""Enter Number: "")
end
  • (A) Error
  • (B) 0
  • (C) Nil
  • (D) Infinite Loop
  • Correct Answer - Option(C)
  • Views: 137
  • Filed under category Ruby

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics