Casio fx-5800P Calculator User Manual


 
E-118
Function Executes another separate program (subroutine) from the current program
(main routine).
Subroutines
Main Routine
Level 1 Level 2 Level 3 Level 4
• A subroutine can be called up as many times as you like from the main
routine. A subroutine can be called up from any number of main routines.
• Execution of the Prog "fi le name" command jumps to the subroutine and
runs it from the beginning. When the end of the subroutine is reached,
processing jumps back to the main routine and continues from the
statement following the Prog "fi le name" command.
• You can use the Prog command inside of a subroutine to cause process
to jump to another subroutine. This is called “nesting”. You can nest
subroutines up to 10 levels. Attempting to nest more than 10 levels causes
an error (Ne ERROR).
• Note that a Goto ~ Lbl jump within a subroutine can be performed only
within the same subroutine.
• An error (Go ERROR) will occur if the program specifi ed by the Prog "fi le
name" command cannot be found for some reason.
Important!
• A program that uses Formula as the run mode cannot be used as a
subroutine.
• The main routine and the subroutine must be the same run mode. This
means, for example, that a subroutine that is a program whose run mode
is BASE-N cannot be called by a main routine that is a program whose run
mode is COMP.
Example Ans
A : Prog "SUB1" : Prog "SUB2"
Note For information about using the Prog command outside of the PROG Mode,
see “Using the Prog Command to Run a Program” (page 110).
A
Program Control Commands
Break (COMP)
Syntax ... : Break : ...
Function This command forces a break in a For, While, or Do loop, and jumps to the
next command. Normally, this command is used inside of a Then statement
in order to apply a Break condition.
Example While A > 0 : If A > 2 : Then Break : IfEnd : WhileEnd : A
^