+ 1

How can I put 3 variables into the if-condition?

If I want the condition to be more than 25, but less than 100. I have tried: if (25 > x < 100) {...}; but it didn't work.

23rd Jul 2016, 12:25 AM
Squik
Squik - avatar
2 Answers
0
if (x > 25 && x < 100) {...}
23rd Jul 2016, 12:28 AM
Phumus-9
Phumus-9 - avatar
- 1
Use the "&&" logical operator. if (x > 25 && x < 100) { //code } There is no limit to how many of these operators you can have in parameters. Also, the logical operator "||" means "or". So you could do: if (x < 25 || x > 100) { //code }
23rd Jul 2016, 12:29 AM
Cohen Creber
Cohen Creber - avatar