Val: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (1 revision)
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''Val''' [[internal function]] returns A$ expressed as a [[numeric]] value rather than a [[string]].
VAL(<string>)


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


====Comments and Examples====
====Comments and Examples====

Latest revision as of 03:20, 22 May 2014

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.