πŸ“Š Ruby
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) Nil

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
231
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Yatendra Sir
Publisher
πŸ“ˆ
92%
Success Rate