Casio Z1 Gr User Manual
Have a look at the manual Casio Z1 Gr User Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 338 Casio manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.
51 ON GOTO PURPOSE: Jumps to a specified branch destination in accordance with a specified branching condition. FORMAT: branch destination line number Line number ON Condition GOTO [ # program area number ] Numeric expression Single character; 0-9 *Label Label name branch destination line number Line number [ , [ # program area number ] ]* Single character; 0-9 *Label Label name EXAMPLE: ON A GOTO 100, 200, 300 PARAMETERS: 1. Branch condition: Numeric expression truncated to an integer 2. Branch destination line number: integer in the range of 1≤ line number ≤65535 3. Program area number: single character, 0-9 4. Label: Name of a label in the program. EXPLANATION: 1. The GOTO statement is executed in accordance with the value of the expression used for the branch condition. For example, execution jumps to the first branch destination when the value is 1, to the second destination when the value is 2 etc. 2. Program execution does not branch and execution proceeds to the next statement when the value of the condition is less than 1, or if a branch destination corresponding to the value does not exist. 3. Up to 99 branch destinations may be specified. SAMPLE PROGRAM: 10 INPUT “1 OR 23;A 20 ON A GOTO 40,50 30 END 40 PRINT ”ONE”:END 50 PRINT “TWO” Execution jumps to line 40 if 1 . . is entered or to line 50 if 2 . . is entered. SEE: ON GOSUB P0
52 ON GOSUB PURPOSE: Jumps to a specified subroutine in accordance with a specified branching condition. FORMAT: branch destination line number Line number ON Condition GOSUB [ # program area number ] Numeric expression Single character; 0-9 *Label Label name branch destination line number Line number [ , [ # program area number ] ]* Single character; 0-9 *Label Label name EXAMPLE: ON A GOSUB 1000, 1100, 1200 PARAMETERS: 1. Branch condition: Numeric expression truncated to an integer 2. Branch destination line number: integer in the range of 1≤ line number ≤65535 3. Program area number: single character, 0-9 4. Label: Name of a label in the program. EXPLANATION: 1. The GOSUB statement is executed in accordance with the value of the expression used for the branch condition. For example, execution jumps to the first branch destination when the value is 1, to the second destination when the value is 2 etc. 2. Program execution does not branch and execution proceeds to the next statement when the value of the condition is less than 1, or if a branch destination corresponding to the value does not exist. 3. Up to 99 branch destinations may be specified. SEE: RETURN P0
53 IF-THEN-ELSE / IF-GOTO-ELSE PURPOSE: Executes the THEN statement or GOTO statement when the specified condition is met. The ELSE statement is executed when the specified condition is not met. FORMAT: THEN statement statement IF condition [ : statement ELSE [ : statement Numeric expression GOTO branch destination branch destination branch destination line number Line number With branch destination: # program area number ] ]* Single character; 0-9 *Label Label name EXAMPLE: IF A=0 THEN 300 ELSE 400 IF K$=”Y” THEN PRINT X ELSE PRINT Y PARAMETERS: 1. Branch condition: Numeric expression truncated to an integer 2. Branch destination line number: integer in the range of 1≤ line number ≤65535 3. Program area number: single character, 0-9 4. Label: Name of a label in the program. EXPLANATION: 1. The statement following the THEN clause is executed, or execution jumps to the destination specified by the GOTO statement when the branch condition is met. 2. If the branch condition is not met, the statement following the ELSE statement is executed, or the program jumps to the specified branch destination. Execution proceeds to the next program line when the ELSE statement is omitted. 3. The format “IF A THEN –“ results in the condition being met when value of the expression (A) is not 0 (absolute value of A > 10-99). The condition is not met when the value of the expression is 0. 4. IF statements can be nested (an IF statement may contain other IF statements). In this case, the THEN – ELSE statements are related by their proximity. The GOTO – ELSE combinations have the same relationships. IF – THEN IF THEN – ELSE IF – THEN ELSE – ELSE – SAMPLE PROGRAM: 10 INPUT “1 TO 9”;A 20 IF (0
54 FOR-NEXT PURPOSE: Executes the program lines between the FOR statement and NEXT statement and increments the control variable, starting with the initial value. Execution is terminated when value of the control variable exceeds the specified final value. FORMAT: FOR control variable = initial value TO final value Numeric variable name Numeric expression Numeric expression [ STEP increment ] Numeric expression | NEXT [ control variable ] [ , control variable ] * Numeric variable name Numeric variable name EXAMPLE: FOR I=1 TO 10 STEP 0.1 | NEXT I PARAMETERS: 1. Control variable: numeric variable name. Array variables cannot be used. 2. Initial value: Numeric expression 3. Final value: Numeric expression 4. Increment: Numeric expression (default value = 1). EXPLANATION: 1. None of the statements beyween FOR and NEXT are executed and the program proceeds to the next executable statement after NEXT when the initial value is greater than the final value. 2. Each FOR requires a corresponding NEXT. 3. FOR – NEXT loops can be nested (a FOR – NEXT loop can be placed inside another FOR – NEXT loop). Nested loops must be structured as shown below with NEXT appearing in inverse sequence of the FOR (e.g. FOR A, FOR B, FOR C – NEXT C, NEXT B, NEXT A). 10 FOR I=1 TO 12 STEP 3 20 FOR J=1 TO 4 STEP 0.5 30 PRINT I,J 40 NEXT J 50 NEXT I 60 END 4. FOR – NEXT loops can be nested up to 29 levels. 5. The control variable may be omitted from NEXT. However, use of the control variable in the NEXT statement is recommended when using nested loop, to make the code easier to understand. 6. NEXT statements can be chained by including them under one NEXT statement, separated by commas. 10 FOR I=1 TO 12 STEP 3 20 FOR J=1 TO 4 STEP 0.5 30 PRINT I,J 40 NEXT J,I 50 END P0
55 7. The control variable retains the value that exceeds the final value (and terminates the loop) when loop execution is complete. With the loop FOR I=3 to 10 STEP 3 for example, the value of control variable I is 12 when execution of the loop is complete. 8. Jumping out of a FOR – NEXT loop is also possible. In that case, the current control variable value is retained in memory, and the loop can be resumed by returning with a GOTO statement. REM (‘) PURPOSE: Allow remarks or comments to be included within a program. This command in not executed. FORMAT: REM comments ‘ String expression EXPLANATION: 1. Including an apostrophe or REM statement following the line number indicates that the following text is comments and should be ignored in program execution. 2. The apostrophe may be included at the end of any executable statement to indicate that the following text is comments. The REM statement can only be used at the beginning of a line. 3. Any command following a REM statement is treated as comment and is not executed. SAMPLE PROGRAM: 10 REM This is a comment 20 ‘This is as well a comment 30 LET A=1: REM I can comment within a line 40 LET N=1 ‘The apostrophe does not require : LET PURPOSE: Assigns the value of an expression on the right side of an equation to the variable on the left side. FORMAT: [LET] numeric variable name = Numeric expression [LET] string variable name = String expression EXPLANATION: 1. Assigns the value of an expression on the right side of an equation to the variable on the left side 2. Numeric expressions can only be assigned to numeric variables, and string expressions can only be assigned to string variables. A “TM error” is generated when an attempt is made to assign a string expression to a numeric variable, and vice versa. 3. LET may be omitted. SAMPLE PROGRAM: 10 LET A=10 20 B=20 ‘LET statement is omitted 30 PRINT A;B P0 A0
56 DATA PURPOSE: Holds data for Reading by the READ statement. FORMAT: DATA [ data ] [ , [ data ] ] * Constant Constant EXAMPLE: DATA 10,5,8,3 DATA CAT,DOG,LION PARAMETERS: 1. Data: String constants or numeric constants 2. String constants: Quotation marks are not required unless the string contains a comma that is part of the data. A null data string (length 0) is assumed when data is omitted from this statement. EXPLANATION: P0
57 5.8.4 Mathematical Functions ABS PURPOSE: Returns the absolute value of the argument. FORMAT: ABS (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: ABS (-1.1) PARAMETERS: argument : numeric expression SEE: SGN ACS PURPOSE: Returns the angle value for which cosine (angle value) = argument. FORMAT: ACS (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: ACS (0.1) PARAMETERS: argument must be within the [-1 , +1] range EXPLANATION: 1. The unit of the returned value is specified using the ANGLE function. 2. The returned value is in the [0, 180°] or [0 , π Radians ] range. SEE: ANGLE, COS ANGLE PURPOSE: Specifies the angle unit. FORMAT: ANGLE angle specification Numeric expression EXAMPLE: ANGLE 0 PARAMETERS: angle specification: Numeric expression truncated to an integer in the range of 0 ≤ angle specification ≤ 3 EXPLANATION: 1. The angle units for the trigonometric functions can be specified using the values 0,1 and 2. 0: DEG (Degrees) 1: RAD (Radians) 2: GRAD (Grads) 2. The relationships between the angle units are as follows: 90° = π/2 Radians = 100 Grads 3. ANGLE 0 is set whenever ALL RESET is executed. 4. The angle unit can also be specified using the MODE command. SEE: MODE, SIN, COS, TAN F0 F0 A0
58 ASN PURPOSE: Returns the angle value for which sine (angle value) = argument. FORMAT: ASN (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: ASN (0.1) PARAMETERS: argument must be within the [-1 , +1] range EXPLANATION: 1. The unit of the returned value is specified using the ANGLE function. 2. The returned value is in the [0 , 180°] or [0 , π Radians ] range. SEE: ANGLE, COS ATN PURPOSE: Returns the angle value for which tangent (angle value) = argument. FORMAT: double atan(x) double x; ATN (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. PARAMETERS: argument must be within the [-1x10100 , +1x10100] range. EXPLANATION: 1. The unit of the returned value is specified using the ANGLE function. 2. The returned value is in the [-90° , 90°] or [ -π/2 , π/2 Radians ] range. SEE: ANGLE, TAN COS PURPOSE: Returns the value of the cosine of the argument. FORMAT: COS (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: COS (30) PARAMETERS: argument: numeric expression (angle). -1440° < argument < 1440° -8π Radians < argument < 8π Radians -1600 Grads < argument < 1600 Grads EXPLANATION: 1. The unit of the argument is specified using the ANGLE function. 2. The returned value is in the [-1 , 1] range. SEE: ANGLE, ACS, SIN, TAN F0 F0 F0
59 CUR PURPOSE: Returns the cubic root of the argument. FORMAT: CUR (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: Y = CUR (X) PARAMETERS: argument: numeric expression. SEE: SQR EXP PURPOSE: Returns the value of e(argument). FORMAT: EXP (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: EXP (1) PARAMETERS: argument must be within the [-230.2585092 , +230.2585092] range. EXPLANATION: 1. The value of e is 2.7182818284590452353602874713526... 2. The returned value is in the ]0 , 10100[ range. SEE: LN FACT PURPOSE: Returns factorial of argument. FORMAT: FACT (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: A = FACT(10) PARAMETERS: argument must be an integer in the [0 , 69] range. EXPLANATION: 1. Returns factorial of the argument: FACT (n) = n! = 1 x 2 x 3 x . . . x n 2. A fractional value as the argument generates an error. SEE: NPR F0 F0 F0
60 FIX PURPOSE: Returns the integer part of the argument. FORMAT: FIX (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: FIX (-1.5) PARAMETERS: argument : numeric expression SEE: INT, FRAC FRAC PURPOSE: Returns the fractional part of the argument. FORMAT: FRAC (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: FRAC (3.14) PARAMETERS: argument : numeric expression EXPLANATION: 1. Returns the fractional art of the argument. 2. The sign (±) of the value is the same as that for the argument. SEE: INT, FIX HYPACS PURPOSE: Returns the value for which hyperbolic cosine (value) = argument. FORMAT: HYPACS (argument) Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable. EXAMPLE: HYPACS (150) PARAMETERS: argument must be within the [1 , 5x1099[ range EXPLANATION: 1. The mathematical formula for reverse hyperbolic cosine is : acosh(x) = ln ( x + √ ) where ln is the natural logarithm . 2. The returned value is in the [-230.2585092 , +230.2585092] range. SEE: HYPCOS, LN F0 F0 F0 x2 – 1