b14 6 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
Pandemic 2852 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 }
b14 6 Author 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.