GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Ruby

 Print  |  
Question:  How does nil and false duffer?



August 08, 2007 01:07:28 #1
 natchiar   Member Since: Visitor    Total Comments: N/A 

RE: How does nil and false duffer?
 
The difference of the methods nil and false is shown by executing nil.methods - false.methods and false.methods - nil.methods.

In a Hash, nil cannot be a value, but false can.

It is recommened that a method returns true or false if it is a predicate, and a value or nil otherwise.

A method with suffix ? is usually a predicate, but some built-in functions are not.
     

 

Back To Question