Explain the difference between nil and false in ruby.

Answer

The differences of the methods nil and false are:

- nil cannot be a value, where as a false can be a value
- A method returns true or false in case of a predicate, other wise nil is returned.
- false is a boolean data type, where as nil is not.
- nil is an object for NilClass, where as false is an object of for FalseClass

All ruby Questions

Ask your interview questions on ruby

Write Your comment or Questions if you want the answers on ruby from ruby Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---