Order in "if"
#1

Hello, i have a question.

If my if has 2 conditions (&&) will the second part of it will even be evaluated if the first part is false?


I came up with this when one part had only a "==" in it, and the other was a function with a pretty big loop in it.
Reply
#2

From what I understand, you mean something like:
pawn Код:
if(case 1 is false && case 2 is true)
{
}
No, the second part will not be evaluated, this checks if both are true.

You need to do the following:
pawn Код:
if(case 1 || case 2)
{
}
This will check if one of the cases is true.

Or you can do two "if"s, like the following:
pawn Код:
if(case 1)
{
}
else if(case 2)
{
}
Good luck.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)