|
Answer» Define the MAIN differences between nil and false in Ruby? Below are the four main difference between nil and and false:- (1)nil:-Here in ruby nil cannot be a value. (1)false:-Here in ruby false can be treated as value.
(2)nil:-nil is not a BOOLEAN data type (2)false:-false is a boolean data type.
(3)nil:-In ruby nil is an object of nilclass. (3)false:-In ruby false is an object of falseclass.
(4)nil:-nil is returned where there is no predicate. (4)false:-when there is case of predicate value of true or false is returned by a METHOD.
|