Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 1-Ruby/blocks.rb @ 10:0374ae06729e
Start playing around with loop block definitions
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 02 Jan 2017 21:01:39 +0000 |
parents | |
children |
line wrap: on
line source
#! /usr/bin/env ruby x = 1 # Inline loops x = x + 1 while x < 10 puts x x = x - 1 until x == 1 puts x # Conventional loops while x < 10 x = x + 1 end puts x until x == 1 x = x - 1 end puts x