Casio fx-50F Calculator User Manual


 
E-68
For~To~Next
Syntax For {expression (starting value)}
{variable (control variable)} To {expression
(ending value)} : {statement} : ... {statement} : Next : ....
Function Execution of the statements from For to Next repeats as the control variable
is incremented by 1 with each execution, starting from the starting value.
When the value of the control value reaches the ending value, execution
jumps to the statement following Next. Program execution stops if there is no
statement following Next.
Example For 1
A To 10 : A
2
B : B
^
Next
For~To~Step~Next
Syntax For {expression (starting value)}
{variable (control variable)} To {expression
(ending value)} Step {expression (step)} : {statement} : ... {statement} :
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 Statement
g
While~WhileEnd
Syntax While {conditional expression} : {statement} : ... {statement} : 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.
A
Program Control Commands
g
Break
Syntax .. : {Then ; Else ;
S
} Break : ..
Function This command forces a break in a For or While 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 ?
A : While A > 0 : If A > 2 : Then Break : IfEnd : WhileEnd : A
^
A
Setup Commands
These commands function the same way as the calculator’s various setup settings. For
more information, see “Calculator Setup” on page 8.