Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 310 Bytes

File metadata and controls

18 lines (15 loc) · 310 Bytes

Return in void methods

In void methods, you can still exit early with a return statement, but you do not give any value after it.

void doStuff() {
    int i = 0;
    while (true) {
        if (i == 8) {
            return;
        }

        IO.println(i);
    }
}
~void main() {doStuff();}