ElsIf
DRAFT

Misconception:

The elsif keyword allows the creation of multi-way if statements like this: if (c1) {...} elsif (c2) {...} else {...}.

Incorrect

There is an elsif keyword for multi-way conditional statements

Correct

Correction
Here is what's right.

There is no elsif in Java.

The following code is incorrect:

if (c1) {
  ...
} elsif (c2) { // illegal
  ...
} else {
  ...
}

It has to be written like this:

if (c1) {
  ...
} else if (c2) { // if nested inside an else
  ...
} else {
  ...
}

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.