0 votes
in Ruby by
What is the difference between nil and false in Ruby?

1 Answer

0 votes
by

Below is the difference between nil and false in Ruby :

Nil

nil cannot be a value.

nil is returned where there is no predicate.

nil is not a boolean data type.

nil is an object of nilclass.

False:

false can be a value.

in case of a predicate, true or false is returned by a method.

false is a boolean data type.

false is an object of falseclass.

...