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 01:46.|