Ruby - Operators and Expressions
Which of the following is the correct syntax to check if a variable
x is falsy in Ruby?x is falsy in Ruby?!x returns true if x is falsy (false or nil).if x == false only checks if value is exactly false, missing nil. if x.nil? only checks for nil, missing false. if x != true returns true for truthy values like 0, incorrectly treating them as falsy. if !x is idiomatic and correct.if !x is the correct and idiomatic way -> Option A15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions