Val

From BR Wiki
(Redirected from VAL)
Jump to navigation Jump to search
VAL(<string>)

The Val(A$) internal function returns A$ expressed as a numeric value rather than a string.

Comments and Examples

00010 LET A$ = "12"
00020 LET B$ = "34"
00030 PRINT VAL(A$)+VAL(B$)

Line 30 will print the number 46.

Related Functions

The inverse function of VAL(A$) is STR$(X). PRINT STR$(VAL("12")) will print the string value "12" without the quotation marks.

Technical Considerations

  1. The string in A$ can contain only spaces, digits, a plus sign, a minus sign, and a period; any other characters will generate a conversion error. These conversion errors can be trapped with the CONV error condition.