}Else if error

Discussion in 'Plugin Development' started by Kriddeh, Aug 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Kriddeh

  2. Offline

    adam753

    This is a simple syntax issue caused by inconsistent layout. You're forgetting to close some of your brackets.
    Code:
    if(args[0].equalsIgnoreCase("1"));{
        if(economy.getBalance(pn)>=darmourPrice){
            //stuff
        }else{
            //other stuff
    }else if(args[0].equalsIgnoreCase("2"));{
    
    If we ignore the indentation here and look at this code in a basic form, what you're doing is this:
    Code:
    if { if { } else { } else { } }
    You can't follow an else by an else. You simply forgot to close one of your brackets. If your code were indented consistently by a standard, it would have been more clear.

    Oh, I'd also like to know, why do you have semicolons following some of your if statements?
    Code:
    if(args[0].equalsIgnoreCase("1"));{
                                     ^
    Wouldn't that make the entire code section do nothing? I assume those are just typos, but you have them in several places..
     
    1Rogue likes this.
Thread Status:
Not open for further replies.

Share This Page