28.09.2018, 01:07
Quote:
What does two parentheses mean on a conditional? like
Код:
if(! (3 <= strlen( inputtext ) <= 20)) Код:
if( (pInfo[i][AdminLevel] > pInfo[playerid][AdminLevel] ) && (pInfo[i][AdminLevel] >= 2) && (i != playerid) |
Very similar to this:
Код:
5 + 6 * 7 = 47
Код:
(5 + 6) * 7 = 77
Код:
if(3 <= strlen( inputtext ) <= 20)
With the additional brackets and the exclamation mark, this will negate the outcome of this check. So this:
Код:
if(! (3 <= strlen( inputtext ) <= 20))
Same for expressions where AND and OR are used at the same time, there is a specific order and when it's not respected the outcome will be totally different.
So this:
Код:
if(var1 == 3 && var2 == 4 || var == 4 && var2 == 3)
Код:
if((var1 == 3 && var2 == 4) || (var == 4 && var2 == 3))
The second code will accept 3 & 4 OR 4 & 3 respectively.