
Examples:
GETBITS(#22122) returns 32.
GETBITS(#1:45h) returns 45.
R→B
Syntax: R→B(integer)
Converts a decimal integer (base 10) to an integer in the default base.
Example: R→B(13) returns #1101b (if the default base is binary) or #Dh (if the default base is hexadecimal).
SETBITS
Syntax: SETBITS(#integer[m] [,bits])
Sets the number of bits to represent integer. Valid values are in the range –63 to 64. If m or bits is omitted,
the default value is used.
Example: SETBITS(#1111b, 15) returns #1111:15b
SETBASE
Syntax: SETBASE(#integer[m][c])
Displays integer expressed in base m in whatever base is indicated by c, where c can be 1 (for binary), 2 (for
octal), or 3 (for hexadecimal). Parameter m can be b (for binary), d (for decimal), o (for octal), or h (for
hexadecimal). If m is omitted, the input is assumed to be in the default base. Likewise, if c is omitted, the
output is displayed in the default base.
Examples: SETBASE (#34o,1) returns #11100b while SETBASE (#1101) returns #0h ((if the default
base is hexadecimal).
I/O
I/O commands are used for inputting data into a program, and for outputting data from a program. They allow
users to interact with programs.
CHOOSE
Syntax: CHOOSE(var, "title", "item1", "item2",…,"itemn")
Displays a choose box with the title and containing the choose items. If the user selects an object, the variable
whose name is provided will be updated to contain the number of the selected object (an integer, 1, 2, 3, …) or
0 if the user taps .
Returns true (not zero) if the user selects an object, otherwise return false (0).
Example:
CHOOSE
(N,"PickHero","Euler","Gauss","Newton");
IF N==1 THEN PRINT("You picked Euler"); ELSE IF N==2 THEN PRINT("You
picked Gauss");ELSE PRINT("You picked Newton");
END;
END;
606 Chapter 28 Programming in HP PPL
Komentarze do niniejszej Instrukcji