DRAFT
Observed
There is an elsif keyword for multi-way conditional statements
There is no special keyword for multi-way conditional statements
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 {
...
}
Other programming languages feature an “elsif” construct (e.g., elif
in Python) that allows chaining multiple conditions in a more concise way.
Students may be transferring this knowledge to Java, expecting an elsif
keyword to exist.