Or operand with int in if statement

前端 未结 12 1943
傲寒
傲寒 2021-01-25 07:45

My problem is that program is not reading codes as i intended \"he\" would.

I have

if (hero.getPos() == (6 | 11 | 16)) {
    move = new Object[] {\"Up\",         


        
12条回答
  •  情歌与酒
    2021-01-25 08:08

    No, you're going to need to check ci.getNumber() == ... for each value, or add them to a collection and check myCollection.contains(ci.getNumber()). However, you may want to re-think the structure of your code if you are checking a method against several known values.

提交回复
热议问题