Go4Expert (http://www.go4expert.com/)
-   Ruby on Rails (http://www.go4expert.com/forums/ruby-on-rails/)
-   -   Loops & Iterators in Ruby (http://www.go4expert.com/forums/loops-iterators-ruby-t28400/)

arunsoni1989 17May2012 23:19

Loops & Iterators in Ruby
Ruby provides the basic while and unless loops and iterators. Let us go through while and until first before looking at iterators.

A "while" loop defines that a statement or block of code is to be rerun time and time again while a condition remains true, and then execution is to continue after the statement or block. An "until" loop says that the block is to be performed until the condition goes true (i.e. while it is false).

Just like the "if" and "unless", "while" and "until" are written with an 'end' key-worded block, or as modified after a piece of code.

All times are GMT +5.5. The time now is 15:51.