The return Statement

The return Statement

  • Exits from the current method, and control flow returns to where the method was invoked.
  • Has two forms: one that returns a value, and one that doesn't. To return a value, simply put the value (or an expression that calculates the value) after the return keyword.
  • The data type of the returned value must match the type of the method's declared return value. When a method is declared void, use the form of return that doesn't return a value.

Related concepts

The return Statement — Structure map

Clickable & Draggable!

The return Statement — Related pages: