Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 469 Bytes

File metadata and controls

26 lines (20 loc) · 469 Bytes

Return Values

You can use a method call on the right hand side of an = to get the value returned by the method.

int returnsEight() {
    return 8;
}

void main() {
    int value = returnsEight();
    IO.println(value);
}

The method call can also be used directly in expressions without assigning the value to a variable first.

String returnsName() {
    return "Mariah";
}

void main() {
    IO.println(returnsName() + " is my name");
}