In a an "if" statement, can I have multiple conditions. For example can I have " if( 5<x<20) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In a an "if" statement, can I have multiple conditions. For example can I have " if( 5<x<20)

21st Jan 2020, 4:29 AM
Michael Trungold
Michael Trungold - avatar
3 Answers
+ 5
Yes, with logical operators: if(x>5&&x<20)
21st Jan 2020, 4:38 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 1
Thanks
21st Jan 2020, 5:15 AM
Michael Trungold
Michael Trungold - avatar
+ 1
this refers to && (and), || (or), ! (not)
21st Jan 2020, 5:16 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar