Holla Tech - Learn

Booleans
 

In Ruby, there are two Boolean values: true and false

isOnline = true

userIsAdmin = false 

 

NOTE!
Another value that you will often encounter is nil. It shows the absence of value.

Booleans
 

If you try to evaluate a value other than true or false as a Boolean, Ruby will automatically treat it as a Boolean.
When this is done, a non-Boolean value that evaluates to true is called “truthy” and a non-Boolean value that evaluates to false is called “falsey“.

In Ruby only false and nil are falsey. Everything else is truthy (even 0 is truthy).

NOTE!
Another value that you will often encounter is nil. It shows the absence of value.

BACK  NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE RUBY MAIN COURSE PAGE. 

RUBY MAIN COURSE PAGE

 


© License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT