|
%num() Function |
|
|
%num() function is used to convert the result of the given expression to a number. We already know that if the given parameter is a symbol we can use data type specifier 'n:' in front of the symbol name for the same purpose, but that wouldn't work if the parameter is an expression. Syntax: %num(expression [, default-number]) expression The expression whose result is subject for conversion. default-number The default value to return, in case of the expression result cannot be converted to a number. This parameter is optional and if omitted and if the result cannot be converted to a number an CScript exception occurs.
Examples: %doif( num(PRICE,100) > MAXPRICE) ... %doend()
%set( A, num(sstr(B,1,2)) * 2 )
|