When program execution returns to the main program, it resumes from the point immediately after the command that jumped to the subroutine.

Example 1:

Main Program:Subroutine: “Sub1”
Jumps to subroutine program “Sub1”

Example 2:

Main Program:

Subroutine: “Sub2”

Assigns the values of main program variables “A” and “B” to the parameter variables (D and E) in subroutine “Sub2”, and then jumps to subroutine “Sub2”.

Using Strings in a Program

A string is a series of characters inside of quotation marks. In a program, strings are used to specify display text. A string made up of numbers (like “123”) or an expression (like x–1”) cannot be processed as a calculation.

Tip: To include quotation marks (") or a backslash (\) in a string, put a backslash (\) in front of the quotation marks (") or backslash (\).

Examples:

 

To include Japan: “Tokyo” in a stringTo include main\abc in a string
Print "Japan:\"Tokyo\""Print "main\\abc"
Running a Program

Example: To run the “OCTA” program created under “Creating a Program” (page 190) to calculate the surface areas and volumes of three regular octahedrons, the lengths of whose sides are 7, 10, and 15

uTo run a program1.On the Program Loader window, specify the program you want to run.(1)Tap the [Folder] down arrow button, and then select the folder you want.

(2)Tap the [Name] down arrow button, and then tap the name of the file. Here, we will tap “OCTA”.

In this example, the “Parameter” input box is left blank. For information about using the “Parameter” input box, see “Configuring Parameter Variables and Inputting Their Values When Creating a Program” (page 191).

2.Tap ., or tap [Run] and then [Run Program] to run the program.

This runs the program and displays a dialog box prompting for input of a value for variable A (length of one side).

Chapter 12: Program Application

192