beautypg.com

Remote Processing CAMBASIC User Manual

Page 169

background image

Comm ands - 136

VAL

Numeric Fun ction

SYNTAX:

n = VAL(m$)

PURPOSE:

To convert a string to a number.

REMARK S:

The V AL fun ction strips lea ding spaces fr om m $ before calculating the r esult.

A leading alphanumeric character will always cause zero to be returned, regardless of the characters
that follow the alphanumeric character.

Trailing alphanumeric character s are ignored.

RELATED:

STR$, ASC, C HR$

EXAMPLE:

PRINT VAL(" 98")
98

PRINT VAL("A56")
0

PRINT VAL("12BB")
12

PRINT VAL("LAST")
0

ERROR:

none