On Sat, Sep 24, 2011 at 11:19 AM, Thomas B. <sinixlol / gmail.com> wrote:

> Ok, that makes a lot more sense. So basically, what you're saying is if
> I had a single argument in a conditional statement (even a variable?) it
> would evaluate to true?
>

Unless it is "nil" or "false"


> I.e.:
>
> x = 1
>
> if x
>  puts x
> end
>
> If I'm understanding this correctly, the above statement will just
> evaluate to true? Or is this only true with a string?
>
> Sorry if this all sounds a bit stupid, but I'm just trying to fully
> grasp the concept of how arguments are evaluated in conditional
> statements.
>

There are only 2 objects that are "false":

* false
* nil

All the rest is "true", e.g.

* 0 # zero
* []  # emtpy array
* ""  # empty string
are all "true"

Peter