DRAFT
ElsIf
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
CorrectionHere is what's right.
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 {
...
}
Language
Java