On Mar 17, 12:01=A0pm, An=EDbal Rojas <anibalro... / gmail.com> wrote:
> Hello,
>
> =A0 =A0I am kind of lost with the nil result while I am expecting a false=
:
>
> irb(main):001:0> =A0x =3D 'foo' if false
> =3D> nil
> irb(main):002:0> x
> =3D> nil
> irb(main):003:0> =A0x =3D 'foo' if true
> =3D> "foo"
> irb(main):004:0> x
> =3D> "foo"
>
> =A0 =A0Thanks in advance for sharing your knowledge,
>
> --
> An=ECbal Rojas

See http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#=
UH
'if' doesn't return the logical value it evaluates, it returns the
value of the last statement
executed, in the false case nothing is executed, and nil is Ruby's
nothing value

Cheers