[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

RETURN

TYPE: Statement
FORMAT: RETURN

Action: The RETURN statement is used to exit from a subroutine called for by a GOSUB statement. RETURN restarts the rest of your program at the next executable statement following the GOSUB. If you are nesting subroutines, each GOSUB must be paired with at least one RETURN statement. A subroutine can contain any number of RETURN statements, but the first one encountered will exit the subroutine.

EXAMPLE of RETURN Statement:
   10 PRINT"THIS IS THE PROGRAM"
   20 GOSUB 1000
   30 PRINT"PROGRAM CONTINUES"
   40 GOSUB 1000
   50 PRINT"MORE PROGRAM"
   60 END
   1000 PRINT"THIS IS THE GOSUB":RETURN

RIGHT$

TYPE: String Function
FORMAT: RIGHT$ (<string>,<numeric>)

Action: The RIGHT$ function returns a sub-string taken from the rightmost end of the <string> argument. The length of the sub-string is defined by the <numeric> argument which can be any integer in the range of 0 to 255. If the value of the numeric expression is zero, then a null string ("") is returned. If the value you give in the <numeric> argument is greater than the length of the <string> then the entire string is returned.

EXAMPLE of RIGHT$ Function:
   10 MSG$="COMMODORE COMPUTERS"
   20 PRINT RIGHT$(MSG$,9)
   RUN

   COMPUTERS

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 14, 1998.