| Previous | Contents | Index |
EXTEXT$ returns explanatory text associated with a specified exception number. See also the EXLABEL$ function example above.
| Example 6-164 EXTEXT$ function |
|---|
print extext$(2001) Subscript out of bounds |
EXTYPE returns the number of the last exception that occurred. It is returned as an integer.
| Example 6-165 EXTYPE function |
|---|
try_it
stop
routine try_it
when exception in
open #1: name 'xx.yy'
use
print 'Open error at '; exlabel$
print 'Error was: '; extype
end when
end routine
Open error at TRY_IT.0002
Error was: 7110
|
or
SYSTEXT$ returns the text associated with the operating system status specified. If no int_expr is supplied, SheerPower returns the text for the last system status. SYSTEXT$ is often used with _STATUS system function.
| Example 6-166 SYSTEXT$ function |
|---|
print systext$ The operation completed successfully. |
The following are miscellaneous functions that SheerPower performs:
With the DECODE function, given the string representation of a number and the base that the value is in (int_expr), SheerPower returns the value in base 10. The number is returned as a real number. See also Section 6.4.11, ENCODE$(num_expr, num_int).
| Example 6-167 DECODE function |
|---|
do
line input 'Enter a HEX value', default 'ff': hex$
if _exit then exit do
print 'Decimal value is'; decode(hex$,16)
loop
end
Enter a HEX value? ff
Decimal value is 255
Enter a HEX value? exit
|
The DTYPE function returns as an integer value, the data type of an expression or object variable: 1 = string, 2 = integer, 3 = real. See Section 5.1, DECLARE for more on declaring variable data types.
| Example 6-168 DTYPE function |
|---|
declare object x x = 45.6 print dtype(x) end 3 |
This function evaluates the expression described in str_expr and returns the result. If the variable being assigned the result is dynamic, the function puts the result in whatever data type the expression result was in. If the variable is NOT dynamic and the result is the wrong data type, a "Data type mismatch" error is returned.
| Example 6-169 EVAL function |
|---|
line input 'Enter an expression': a$ print 'The result is '; eval(a$) end Enter an expression? 5 + 4 The result is 9 |
FALSE returns the constant 0. It is returned as an integer. See also "TRUE function".
| Example 6-170 FALSE function |
|---|
input 'Enter your age': age of_age? = false if age >= 18 then of_age? = true print 'Given your age, you are '; if of_age? then print 'plenty old!' else print 'too young!' end Enter your age? 22 Given your age, you are plenty old! run Enter your age? 7 Given your age, you are too young! |
Given an array and a dimension number, this function returns the low bound for that dimension. The default dimension is 1.
| Example 6-171 LBOUND function |
|---|
dim temperature(-40 to 100) print 'Lowest temperature we can handle: '; lbound(temperature,1) print 'Highest temperature we handle : '; ubound(temperature,1) end Lowest temperature we can handle: -40 Highest temperature we handle : 100 |
MAXNUM returns the largest number available in this implementation of SheerPower.
| Example 6-172 MAXNUM function |
|---|
print maxnum 9223372046854775807 |
SIZE returns the number of elements in one dimension of an array.
| array-name | Array to examine | |
| int-expr | Dimension to get the size of. The default dimension is 1. |
| Example 6-173 SIZE function |
|---|
dim calendar(366) print 'Size of this calendar: '; size(calendar) Size of this calendar: 366 |
TRUE returns the constant 1. It is returned as an integer. See also "FALSE" function.
| Example 6-174 TRUE function |
|---|
input 'Enter your age': age of_age? = false if age >= 18 then of_age? = true print 'Given your age, you are '; if of_age? then print 'plenty old!' else print 'too young!' end Enter your age? 38 Given your age, you are plenty old! rnh Enter your age? 5 Given your age, you are too young! |
Given an array and a dimension number, UBOUND returns the upper bound for that dimension. It returns an integer value. The default dimension is 1.
| Example 6-175 UBOUND function |
|---|
dim temperature(-40 to 100) print 'Lowest temperature we can handle: '; lbound(temperature,1) print 'Highest temperature we handle : '; ubound(temperature,1) end Lowest temperature we can handle: -40 Highest temperature we handle : 100 |
| Previous | Next | Contents | Index |