Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 700 Bytes

File metadata and controls

31 lines (23 loc) · 700 Bytes

Invocation

Once you've declared a method you can run the code inside of it by writing the name of the method followed by () in a statement.

void doThing() {
    IO.println("Hello from inside a method!");
}

void main() {
    doThing();
}

Running the code in a method can be called a few things. "Running a method", "Calling a method", or "Invoking a method."1

You can call a method multiple times. If you do, then the code inside of it will be run multiple times.

void doThing() {
    IO.println("Hello from inside a method!");
}

void main() {
    doThing();
    doThing();
}

Footnotes

  1. I like that last one because "invoking" makes me sound like a Wizard.