Examveda

What is the output of the following code snippet?
x = 5
while x > 0
  puts x
  x -= 1
end

A. 54321

B. 12345

C. Error

D. Infinite loop

Answer: Option B


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

Join The Discussion

Related Questions on Control Structures in Ruby