num() Function

The num() function evaluates an expression and returns 1 (true) if it is a decimal numeric. Otherwise, it returns 0, if the expression contains any nonnumeric characters.

Syntax

num(exp)

Parameter(s)

exp

Expression to test. If it is a decimal numeric, 1 (true) is returned. If it contains any nonnumeric characters, 0 is returned.

Description

The empty, or null string ("") is considered to be a numeric string.

The strings below are considered to be numeric, and return a 1:

Example(s)

This loop terminates when a numeric response is entered for the variable number.

loop

input number

until num(number) do repeat

See Also

alpha() Function, Boolean Evaluation, BASIC Functions, match Relational Operator, Statements and Functions