#Limit to else if statements?

1 messages · Page 1 of 1 (latest)

earnest ginkgo
#
if (Fscore >= 0 && Fscore <= 39) {
        System.out.println("This score has achieved a Fail");
    } else
        if (Fscore >= 40 && Fscore <= 49) {
        System.out.println("This score has achieved a Third class");
        } else
            if (Fscore >= 50 && Fscore <= 59); {
            System.out.println("This score has achieved a Second class, division 2 (or 2.2)");
            } else
                if (Fscore >= 60 && Fscore <= 69); {
                System.out.println("This score has achieved a First class, division 1 (or 2.1)");
                } else {
                    System.out.println("This score has achieved a First class");
        }

I've written this but when I get to the 3rd else if statement it the IDE says "else" without the "if". Not quite sure what that means and why its not allowing this to run?

sage grottoBOT
#

<@&987246399047479336> please have a look, thanks.

sage grottoBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

sonic wyvern
#

ur forgetting ur curly braces

#

and have semicolons where they shouldnt be

#

ur also missing some closing curlies

#
if (...) {
  ...
} else {
  ...
}
#

or, if u want else-if, then write it like that:

#
if (...) {
  ...
} else if (...) {
  ...
}
#

i.e. next to each other

#

not in a new line

#

no semicolon after the if

#

and always use curly braces to open and close ur cases

#

then hit auto-format in ur IDE

#

so that its aligned properly

earnest ginkgo
#

Ohh, thank you