return
The return
statement is used to exit a subroutine at an arbitrary point and return to the calling location
Syntax
return
Details
A subroutine will automatically return to the location it was called from when the end of its body is reached. However it may be desirable to explicitly exit the subroutine at some other point in which case the return
statement is used.
The return
statement cannot be used to return a value to the calling code (this should be done via the use of variables as described in the subroutine statement documentation)
Example
Last updated