Vidyalelo
Ruby Programming · Q57

Control Structures in Ruby

Programming · Ruby Programming · question 57

Q57

What is the output of given code? #counter=1 if counter<=5 puts (counter) counter=counter+1 else puts(counter) counter=counter-1 end

A.
Undefined local variable counter
Answer
B.
1,2,3,4,5
C.
1 2 1
D.
1
2

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board