Answer the question
In order to leave comments, you need to log in
Number-constant at the beginning of the comparison?
From time to time I come across a style of code (js mostly) that puts a constant number first in comparison constructs, for example:
if ( 5 == var ){
// операции
}
Answer the question
In order to leave comments, you need to log in
The point is that if you write '=' instead of '==', then the option
if ( var = 5){
// операции
}
This is called yoda style
https://habrahabr.ru/post/111432/
I
constantly use it with strings
if someVar is null, then there will be no exception
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question