mercredi 12 juillet 2017

But if statement java

I am coding a simple quest board. However, my code looks like this.

if(X > 5) {
mission1 = 1;
} else if (start != 1) {
mission1 = 0;
}

You might see what I want to do, if X is greater then 5 then mission1 should equal 1. But if my private int "start" doesn't equal 1 then mission1 should just be 0;

The problem is, mission1 is always = 1, as X is always greater then 5. That's why I called named this thread "but if statement", isn't there some sort of "but if statement", like, in this case, if start != 1 then mission1 should ignore that X > 5 and set mission1 to 0 instead?

Aucun commentaire:

Enregistrer un commentaire