+ 1

Почему в коде используются 2 амперсанта(&&), а не один?

17th Jun 2018, 7:26 AM
Leshkina Olga Vladimirovna
Leshkina Olga Vladimirovna - avatar
2 Respuestas
+ 4
Здравствуйте, Olga ! when condition1 && condition 2 The second condition is checked only if the first condition is satisfied when condition1 & condition2 The second condition will be checked regardless of the fulfillment of the first condition. It should be noted that instead of a condition there can be an expression. in other words, single & will compare obtained in conditions 1 and 2, and therefore both halves are needed, and double && simply checks the result of the logical expression and if the first (left) part has already given a LIE, then it does not make sense to continue...
17th Jun 2018, 7:29 AM
Alexander Sokolov
Alexander Sokolov - avatar
+ 2
Спасибо большое, все встало на свои места 😊
17th Jun 2018, 7:31 AM
Leshkina Olga Vladimirovna
Leshkina Olga Vladimirovna - avatar