Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Error with case null


    Recommended Posts


    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

    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
    	case 2:
    		// Do something else
    		// It's not 1 or 2, do this


    That fixed it, thank you :)

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.