In if statement ,if there is 1as condition,what would happen? And if contion is x&&y|| z what would happen | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In if statement ,if there is 1as condition,what would happen? And if contion is x&&y|| z what would happen

11th Nov 2018, 2:10 PM
Kaviyarasan Gnanasekaran
Kaviyarasan Gnanasekaran - avatar
2 Answers
+ 12
since &&,|| (logical operators) have associativity from Left to Right & precedence is same so the expression will be treated as : (X&&Y)||Z //where X,Y,Z are conditions
11th Nov 2018, 2:15 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
If X and Y are True statement is True, because first statment is True and and second is not execute because is or . If X and Y are false, first statment is False, and second statment deciding that statment is True or False If z is false all statment is false, And if true all statment is true.
11th Nov 2018, 3:57 PM
Izaak GOLDSTEIN
Izaak GOLDSTEIN - avatar