The if-then-else Statement

The if-then-else Statement

void applyBrakes() {
    if (isMoving) {
        currentSpeed--;
    } else {
        System.err.println("The bicycle has already stopped!");
    } 
}

Provides a secondary path of execution when an "if" clause evaluates to false.

The if-then-else Statement — Structure map

Clickable & Draggable!

The if-then-else Statement — Related pages: