Loops & Iterators in Ruby

Discussion in 'Ruby on Rails' started by arunsoni1989, May 17, 2012.

  1. arunsoni1989

    arunsoni1989 New Member

    May 17, 2012
    Likes Received:
    Trophy Points:
    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.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice