view 1-Ruby/blocks.rb @ 25:e26607247dd2

Add sample data from book
author IBBoard <dev@ibboard.co.uk>
date Fri, 20 Jan 2017 21:01:09 +0000
parents 0374ae06729e
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