Are they though? Maybe they are inputs that haven’t been sanitised but the language has two kinds of equals and is you use the double equals then it tries to coerce it for you. Lol that with would be silly!
And it doesn’t matter, the compiler/interpreter/etc will convert it to the most efficient implementation regardless of what you the human type. If you’re used to the if [boolean] convention use that, if you’re used to if [boolean] == true use that, it does not matter except to style commissars.
captain_aggravated@sh.itjust.works 2 weeks ago
For me the algorithm is “if(wearing_glasses == True and is_brightly_lit == True): stand; else: sit”.
AnAverageSnoot@lemmy.ca 2 weeks ago
Your variables are already booleans, so you can just write:
if (wearing_glasses and is_brightly_lit)pretzelz@lemmy.world 2 weeks ago
Are they though? Maybe they are inputs that haven’t been sanitised but the language has two kinds of equals and is you use the double equals then it tries to coerce it for you. Lol that with would be silly!
Feathercrown@lemmy.world 2 weeks ago
lol what a funny lamguage design horror story. I’m sure glad it’s not real
gandalf_der_12te@discuss.tchncs.de 2 weeks ago
yes but it makes it clearer to do
isWearingGlasses == trueWarl0k3@lemmy.world 2 weeks ago
And it doesn’t matter, the compiler/interpreter/etc will convert it to the most efficient implementation regardless of what you the human type. If you’re used to the
if [boolean]convention use that, if you’re used toif [boolean] == trueuse that, it does not matter except to style commissars.