The VAL
command is a function that allows you to convert a string that represents
a number into a integer numeric value. In other words, it takes a string that contains
numbers and returns the corresponding numeric value.
The VAL
command is very useful when working with user input, because the user
often enters numbers as strings. For example, if we ask the user to enter their age,
the input will be a string. In order to perform calculations with this age, we must
first convert it to a number.
The VAL
function reads the string from left to right and stops at the first
character that is not a number. The VAL
function ignores spaces at the beginning
of the string. If the string does not begin with a number or contains only
non-numeric characters, the VAL
function returns zero.
= VAL(string)
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
VAL ↔ Va
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS