From: Kyle Date: 2009-11-16T02:13:35+09:00 Subject: Re: what's || --Boundary-00=_8aDALfY0yYXJwEP Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit It's the lazy execution boolean or operator x1 = nil x2 = [1,2,3] x3 = [4,5,6] a = x1 || x2.push(4, 5) b = x3 || x2.push(6, 7) # assignment operator version often used to initialize a variable if it doesn't already have a value @var ||= 'something' @var ||= 'whatevs' after wards: a == x2 == [1, 2, 3, 4, 5] b == x3 == [4, 5, 6] @var == 'something' On Sunday November 15 2009 7:59:31 am duxieweb wrote: > sorry just was learning ruby so have some low level questions, :) > > in this statement: > > 1.upto(10) do |c| print c," " end > > what's the usage of "| ... |" in ruby? can't easily understand. > > Thanks. --Boundary-00=_8aDALfY0yYXJwEP--