# Is this if statement right?

I am trying to get this to work, but it won’t.

``````/
/
/
void Update()
{
if ((PlayerTotalLogic.playerTotal == 9)  (PlayerTotalLogic.playerTotal == 10)  (PlayerTotalLogic.playerTotal == 11))
{
dblButton.enabled = true;
}
else
{
dblButton.enabled = false;
}
/
/
/
``````

Do I need to split it up to get it to work. or am I not suppose to use the “==” like this? I am not getting a error.

Did you mean to use ?? is the conditional-AND operator.

Did you mean to use || ?? || is the conditional-OR operator.

Trying using || instead of in this situation and see if it responds how you wanted it.

You’re basically asking if the player total equal 9, 10, and 11. Which is fine in structure but doesn’t make any sense for your purpose. How could the player total possibly equal 3 different outcomes at the same time? I think your trying to ask if its either (or) 9, 10, or 11.

If(playerTotal == 9 || playerTotal == 10 || playerTotal == 11)

Edit, somebody beat me to it.

Not sure what the best way is. I just removed the extra set of “()” around it and it also did not work with no errors.

I will try the “||”.

You are missing a } at the end.

Also the means “and”, so there is a flaw in logic if you expect something to be equal with 10 and 11 and 12, it can only be 10 or 11 or 12, which is ||.

Yes the “||” works, but I am getting a sideeffect that is unwanted. The deal is is that 4 objects are entering the game. Two on the players side and two ont he oponents side. The player gets one first then the oponent then the player gets another and the oponent gets the last one. Is there a way for this statement to calculate the objects after the all of them have entered the game??