Examveda

What is output of the given code?
counter=-3
   if counter<=5
   puts (counter)
   counter=counter+1
   puts (counter)
   elsif counter>5
   puts (counter)
   counter=2*counter
   puts(counter)
   end

A. -3
-2

B. -3
-6

C. Syntax error

D. None of the mentioned

Answer: Option A


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

Join The Discussion

Related Questions on Control Structures in Ruby