I was doing ruby challenge and I failed a question which asked what the value of false was!After the challenge i discovered false evaluates to truth soo...
Why does the boolean 'false' evaluate to truth in ruby?
In Ruby only false & nil are falsey , everything else is truthy ..😊😊😊
the que u r referring in that
false is taken as string "false". so its truthy😎😎😎
I hope u start challenging me in Ruby😎 bro...!!
I will solve all ur doubts 🤣🤣🤣🤣🤣
Well, there are two objects in Ruby that evaluates to false.
2) false (as a boolean value)
I suppose that in challenge there is about "false" string, which evaluates to true.
This is tricky question, but still valid, and even cool imo :)
Apart from true and false, if you try to evaluate something that is not a boolean, ruby will treat them as truthy and falsey. Only false and nil are falsey, everything else is truthy. The boolean false is obviously false, but if it is a string “false”, then ruby treats it as truthy.
@Deoanshu Thakur Sorry if you don’t like me always challenging you 😅I don’t know why but I like to challenge someone who is better than me. If you think I am spamming and disturbing you, please let me know. I will stop challenging you then 😀