What are the looping structures available in Ruby?

Questions by StephenRaj   answers by StephenRaj

Showing Answers 1 - 12 of 12 Answers

natchiar

  • Aug 17th, 2007
 

for..in
untill..end
while..end
do..end

  Was this answer useful?  Yes

Satya

  • Mar 11th, 2013
 

For loop
while loop
until loop
do..end is not a loop(it is alternate form of defining a block)

Code
  1. count = 0

  2. while count < 5 do

  3.         puts count

  4.         count += 1

  5. end

  6.  

  7. for i in 0..4 do

  8.         puts i

  9. end

  10.  

  11. y = 4

  12. until y < 0 do

  13.         puts y

  14.         y -= 1

  15. end

  Was this answer useful?  Yes

Venus Jain

  • Aug 22nd, 2017
 

for, each, while, until, upto, downto, times

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions