You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to truthinessTest, if "hello" says "hello" is truthy
According to equalityComparisonsay true is "hello" says "hello" is falsey
Which one is it? Binary comparison says "Convert the string to a boolean using all defined aliases" but then doesn't define what to do in the failure case, and Truthiness says "String - Truthy" (with no qualifiers).
The text was updated successfully, but these errors were encountered:
These behaviors aren't necessarily exclusive. In Python for example, if "hello": print("hello") will print "hello", but print("hello" == True) prints False. That being said, we should clearly define the intended behavior when the string can't be converted to a boolean.
I'm actually wondering if converting the string "false" to the boolean false when comparing them is confusing. In if "false" and if "false" is true would have different behavior since the comparison converts it but the conditional treats all non-empty strings as truthy.
`
if "hello"
says"hello"
is truthysay true is "hello"
says"hello"
is falseyWhich one is it? Binary comparison says "Convert the string to a boolean using all defined aliases" but then doesn't define what to do in the failure case, and Truthiness says "String - Truthy" (with no qualifiers).
The text was updated successfully, but these errors were encountered: