b14 6 Share Posted May 12, 2020 Hey! So I'm working on some of my first scripts right now and I'm running into an issue where my line of code: case null: is returning with an error saying "Constant expression required". I was under the impression this is how you check if none of the defined enum states are currently active, as I'm new to this I'd appreciate a bit of help on what I'm doing wrong. I'm using IntelliJ IDEA if that means anything. Thanks for any help you can provide Link to comment Share on other sites More sharing options...
Pandemic 2803 Share Posted May 12, 2020 I'm guessing you're in a switch statement, you'll want to use default: switch (x) { case 1: // Do something break; case 2: // Do something else break; default: // It's not 1 or 2, do this } Link to comment Share on other sites More sharing options...
b14 6 Author Share Posted May 12, 2020 10 hours ago, Pandemic said: I'm guessing you're in a switch statement, you'll want to use default: switch (x) { case 1: // Do something break; case 2: // Do something else break; default: // It's not 1 or 2, do this } That fixed it, thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.