Denso RC5 Specifications Page 257

  • Download
  • Add to my manuals
  • Print
  • Page
    / 692
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 256
Chapter 11 Flow Control Statements
11-7
ON-GOSUB (Statement) [Conforms to SLIM]
Function
Calls a corresponding subroutine to the value of an expression.
Format
ON <Expression> GOSUB <Label name>[,<Label name>]
Explanation
This statement makes control jump to the label written in the same order as the
value of <Expression> to continue program execution. The labels are counted
in the order of 1, 2, … from the left.
When the value of <Expression> is real, the system rounds down to the
maximum integer that does not exceed the value and processes it.
Note: If the result of an expression exceeds the order, nothing is
executed.
Related Terms
ON-GOTO, RETURN, SELECT CASE
Example
REM Executes a plural condition decision.
SELECT CASE Index
'The command is executed when the index value matches the CASE
'statement value.
CASE 0 'When the index is 0.
STOP 'Ends the program.
CASE 1 'When the index is 1.
HALT "STOP" 'Suspends execution of the program.
CASE 2 'When the index is 2.
HOLD "STOP" 'Suspends execution of the program.
CASE 3 'When the index is 3.
STOPEND
'Stops a continuous program or stops the program after a cycle.
CASE 4 'When the index is 4.
ON li1 + li2 GOSUB *samp1, *samp2, *samp3
'
Calls the subroutine of a label name written at the same level as the
'value of li1 + li2.
CASE 5 'When the index is 5.
ON li1 + li2 GOTO *samp1, *samp2, *samp3
'Jumps to the label written at the same level as the value of li1 + li2.
CASE 6 'When the index is 6.
END 'Declares the end of movement by a program.
END SELECT
'Declares the end of a plural conditional decision statement.
Notes
Use the RETURN statement to return the control from the subroutine called
with GOSUB (ON-GOSUB) to the program that called the subroutine.
Page view 256
1 2 ... 252 253 254 255 256 257 258 259 260 261 262 ... 691 692

Comments to this Manuals

No comments