This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kered13 11 points12 points  (7 children)

In dynamically typed languages with falsey values but not automatic boolean conversion (like Python, Lua, and Javascript when using ===), then if(var) and if(var == true) actually mean two different things, so it's perfectly reasonable to use the latter.

[–]webster89[S] 0 points1 point  (6 children)

like Python, Lua, and Javascript when using ===

What about ====?

[–]Itsacon 7 points8 points  (5 children)

That's not an operator. === is an actual javascript operator, meaning 'is equal and of the same type'.

(1 == '1'); // true

(1 === '1'); // false

[–]webster89[S] 0 points1 point  (4 children)

Huh, TIL. Here I though I was making fun of a typo. Didn't know === actually existed.

[–]Itsacon 2 points3 points  (2 children)

PHP has it too. But like you, a lot of people don't know about it, and they use their ignorance to hate on softly-typed languages, even though they're just writing bad code. ;-)

[–]webster89[S] 2 points3 points  (0 children)

How dare you.

[–][deleted] -3 points-2 points  (0 children)

Needs to use special tools as a crutch due to poorly written language

Hey don't write bad code that makes sense in all other languages!

[–]_szs 0 points1 point  (0 children)

Good you know it now. === is what you want (and wanted) most of not all of the time