Home / CSE MCQs / Ruby Programming MCQs :: Discussion

Discussion :: Ruby Programming MCQs

  1. What is the output of the given code?

    i = 3
    while i > 0 do
      print i
      i -= 1
    end
  2. A.
    3
    B.
    321
    C.
    Infinite loop
    D.
    3 2 1 0

    View Answer

    Workspace

    Answer : Option B

    Explanation :

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


Be The First To Comment