beautypg.com

A control structure commands: while statements, A subroutine call commands, E-117 – Casio fx-5800P User Manual

Page 118

background image

E-117

For ~ To ~ Step ~ Next

(COMP)

Syntax

For

To Step : :
... : Next : ...

Function

Execution of the statements from For to Next repeats as the control variable
is incremented by the step amount with each execution, starting from the
starting value. Except for that, this command is the same as For~To~Next.

Example

For 1

→ A To 10 Step 0.5 : A

2

→ B : B ^ Next

A Control Structure Commands: While Statements

While ~ WhileEnd

(COMP)

Syntax

While : : ... : WhileEnd : ...

Function

The statements from While to WhileEnd are repeated while the conditional
expression following While is true (non-zero). When the conditional
expression following While becomes false (0), the statement following
WhileEnd is executed.

Example ?

→ A : While A < 10 : A

2

^ A + 1 → A : WhileEnd : A ÷ 2

Note

• If the condition of the While statement is false the fi rst time this command

is executed, execution jumps directly to the statement following WhileEnd
without executing the statements from While to WhileEnd even once.

• To input the WhileEnd command, select “W·End” on the function menu.

Do ~ LpWhile

(COMP)

Syntax

Do : : ... : LpWhile

Function

The statements from Do to LpWhile are repeated while the conditional
expression following LpWhile is true (non-zero). Since the condition is
assessed following execution of LpWhile, the statements from Do to LpWhile
are executed at least once.

Example

Do : ?

→ A : A × 2 → B : B ^ LpWhile B > 10

Note

To input the LpWhile command, select “Lp·W” on the function menu.

A Subroutine Call Commands

Prog

(

1/)

Syntax

... : Prog "fi le name" : ...