Precedence of operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Precedence of operators

In this code if variable passed 0 result to the condition why result is 4 in else block? https://code.sololearn.com/c0vgSFyS7D7q/?ref=app

5th Feb 2020, 4:34 AM
Tokimay
5 Answers
+ 2
https://code.sololearn.com/cYN26HkMh8t2/?ref=app
5th Feb 2020, 4:41 AM
KnuckleBars
KnuckleBars - avatar
+ 2
After closing parenthesis if the a variable is 1 the condition is true in this case condition is false meanes a=0
5th Feb 2020, 4:47 AM
Tokimay
+ 2
No. a++ means it first uses the value of a, then increments it no matter what happens.
5th Feb 2020, 4:48 AM
KnuckleBars
KnuckleBars - avatar
0
🙏
5th Feb 2020, 5:10 AM
Tokimay