Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

VAL

Description

VAL is a function that converts a string containing digits into a numeric value. VAL needs a single argument which is the string.

Example

The following example demonstrates VAL by calculating the equation 30 + (-50) = -20 where both operands are strings.

outmode -2
let a$ = "30"
let b$ = "-50"
let c = val(a$) + val (b$)
print c

Remarks

The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial "+" or "-" sign followed by as many numerical digits as possible, and interprets them as a numerical value. The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function. If the first sequence of non-whitespace characters is not a valid integral number, or if no such sequence exists because either the string is empty or it contains only whitespace characters, no conversion is performed.