beautypg.com

Argox PA-20 Basic Programming Manual User Manual

Page 20

background image

PT-Basic Programming Manual Ver. 1.00

19/143

ON … GOSUB …

Purpose: To call one of the specified subroutines depending on the

value of the expression.

Syntax: ON N% GOSUB SubLabel| SubName {,SubLabel|

SubName}

Example: D% = DAY_OF_WEEK

ON D% GOSUB MON, THE, WED, THR, FRI, SAT, SUN

WHILE INKEY$=""

WEND

END

MON:

PRINT "MONDAY"

RETURN

THE:

PRINT "TUESDAY"

RETURN

WED:

PRINT "WEDNESDAY"

RETURN

THR:

PRINT "THURSDAY"

RETURN

FRI:

PRINT "FRIDAY"

RETURN

SAT:

PRINT "SATURDAY"

RETURN

SUN:

PRINT "SUNDAY"

RETURN

Description: N% is a numeric expression that is rounded to an integer. The

value of N% determines which subroutine is to be called. If

the value of N% is 0 or greater than the number of routines

listed, the interpreter will continue with the next executable

statement.

SubLabel is the name of a subroutine.