Val: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (1 revision)
 
m (moved Val to VAL)
(No difference)

Revision as of 10:18, 17 January 2012

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

Val(A$)

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.