A

Admin • 833K Points
Coach

Q. What will be the output of the given code?

Code:
i = 4
while i > 0 do
print i
i -= 1
end
  • (A) 321
  • (B) 3210
  • (C) 4321
  • (D) 43210
  • Correct Answer - Option(C)
  • Views: 21
  • Filed under category Ruby
  • Hashtags:

Explanation by: Admin

The do statement here indicates that till the while condition is true execute the instructions.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.