--0016e65a10684f831b04b13a2f6d
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Nov 8, 2011 at 7:27 AM, Fily Salas <fs_tigre / hotmail.com> wrote:

> Hi,
>
> Can someone explain the use of double pipes "||" in Ruby?
> Are these part of blocks only?
> Where else can double pipes be used?
>
> The way I understand it, is basically for adding temporary variables to
> help identify items in an array, other than that I'm not sure
> where else can they be used.
>
> Thanks a lot!
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
The most obvious thing you can do is a logical "or"

true || false
ticketed  peed_limit < speed || flips_off_the_cops

They can also be used for things that take arbitrary delimiters such as the
various % ways of defining literals

%|a b c|    # "a b c"
%w|a b c|   # ["a", "b", "c"]

--0016e65a10684f831b04b13a2f6d--