Does anyone have one liner explanation about
(10 == varX)
VS
(varX == 10)
Does anyone have one liner explanation about
(10 == varX)
VS
(varX == 10)
For further actions, you may consider blocking this person and/or reporting abuse
Pablo Discobar -
Sebastian Sdorra -
Mattias Velamsson -
Grigor Khachatryan -
Once suspended, slimdestro will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, slimdestro will be able to comment and publish posts again.
Once unpublished, all posts by slimdestro will become hidden and only accessible to themselves.
If slimdestro is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to D\sTro.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community 👩💻👨💻 safe. Here is what you can do to flag slimdestro:
Unflagging slimdestro will restore default visibility to their posts.
Top comments (9)
I think the idea is that you might put
=
instead of==
by accident. Very difficult to debug, this would be.That said, in languages like JS and PHP that have the concept of
===
, the Yoda syntax becomes a bit irrelevant. I guess the key is consistency. So my advice would be, in the words of the great Jedi Master himself:You got it 👌
Ha sorry not a one liner :D
Usually, they are used to avoid accidental variable assignments (
varX = 10
).Exactly
Aren't they both the same?
More or less. Usually the constant portion of a conditional statement is placed on the right side. Yoda conditions reverse this typical order. This should avoid certain errors. Yet, their use is controversial.
Same ofcourse but they are in place to avoid those million dollar bug NASA scientists creates years ago
Wow really, didn't know about that million dollar bug! Maybe I will convert to start using them :D :D