Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question about switch

Tags:

java

I'm a java beginner, so what's wrong with this code:

switch(keycode) {
    case Keyboard.KEY_UP || Keyboard.KEY_DOWN: 
}

I gives me the following error message:

bad operand types for binary operator '||'
  first type:  int
  second type: int
like image 252
cyrianox Avatar asked Jun 27 '26 06:06

cyrianox


1 Answers

switch(keycode) 
{    

    case Keyboard.KEY_UP:
    case Keyboard.KEY_DOWN: 
        //  code to run...
        break;

}

See The switch Statement

like image 109
Mitch Wheat Avatar answered Jun 28 '26 19:06

Mitch Wheat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!