LEXIBOOK GC500i Instruction Manual page 57

Graphic calculator
Table of Contents

Advertisement

Besides the beginning of the program, branch destinations can be designated at any point within the
program.
Example: calculate y=ax+b when the value for x changes each time, while a and b can also change
depending upon the calculation.
?, →, A, : , ?, °˙, B, :, Lbl, 1, :, ?, →, X, :,
A, x, X, +, B,
When this program is executed, the values for a and b are stored in memories A and B respectively. After
that, only the value for x can be changed.
In this way an unconditional jump is made in accordance with "Goto" and "Lbl", and the flow of program
execution is changed.. when there is no "Lbl n" to correspond to a "Goto n", an error (Go ERROR) is
generated.
4.7.3 Conditional jumps
The conditional jumps compare a numeric value in memory with a constant or a numeric value in another
memory. If the condition is true, the statement following the "⇒" is executed, and if the condition is not
true, execution skips the statement and continues following the next " : " or "
Conditional jumps take on the following form:
Relational
Left side
operator
* Anyone can be used.
One memory name (alphabetic character from A through Z), constant numeric values or calculation for-
mulas (Ax2, D—E, etc.) are used for "left side" and "right side".
The relational operator is a comparison symbol, there are 6 types of relational operators: A, h, k, j, B, '
Left side ≤ right side (left side equals right side)
Left side ≤ right side (left side doesn't equal right side)
Left side ≤ right side (left side is greater than or equal right side)
Left side ≤ right side (left side is less than or equal right side)
Left side ≤ right side (left side is greater than right side)
Left side ≤ right side (left side is less than right side)
The "→" is displayed when
the statement following ⇒. If the condition is not true, the statement following ⇒ is skipped and execu-
tion jumps to the statement following the next "≤" or "
Relational
Left side
operator
A statement is a calculation formula (sin Ax5, etc.) or a program command (Goto, Prog, etc.), and
everything up to next " :" or "
Example: if an input numeric value is greater than or equal to zero, calculate the square root of that value.
If the input value is less than zero, reinput another value.
Program: Lbl, 1, :, ?, →, A, :, A, >, 0, ⇒, √, A,
In this program, the input numeric value is stored in memory A, and then it is tested to determine whether
it is greater than, equal to or less than zero. If the contents of memory A are greater than or equal to 0 (not
less than zero), the statement (calculation formula) located between "⇒" and "
then Goto 1 returns execution to Lbl 1. If the contents of memory A are less than zero, execution will skip
the following statement to the next "
Example: calculate the sum of input numeric values. If a 0 is input, the total should be displayed.
0, →, B, :,
Program
Lbl, 1, :, ?, →, A, :, A, =, 0, ⇒, Goto, 2, :,
A, +, B, →, B, :, Goto, 1, :,
Lbl, 2, :, B
Copyright L
2002
EXIBOOK
, Goto, 1
Right side ⇒ Statement
are pressed. If the condition is true, execution advances to
SHIFT
".
If true
Right side → Statement
If not true
" is regarded as one statement.
, Goto, 1
16 steps
" and return to Lbl 1 by Goto 1.
23 steps
".
{
}
:
* Statement
{
}
:
Statement
" will be executed, and
31 steps
- 57 -
GB

Advertisement

Table of Contents
loading

This manual is also suitable for:

Gc1000i

Table of Contents