view 1-Ruby/blocks.rb @ 16:8d46064c9afc

Be a nice Ruby user and follow block convention for do/end vs {}
author IBBoard <dev@ibboard.co.uk>
date Tue, 03 Jan 2017 20:38:45 +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