Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

VAL()

Syntax:

val!(<string ptr str>) |  val(<string ptr str>) | val%(<string ptr str>)

The VAL() function tries to parse the numeric value in a string pointed by str to the numeric type of the function.

Parsing rules for VAL!()

The VAL!() function will return 0 if:

  • The argument points to an empty string
  • The string is longer than 3 characters
  • The string contains any non-numeric character, including a space
  • The numeric value exceeds 255

Parsing rules for VAL()

The VAL() function will return 0 if:

  • The argument points to an empty string
  • The string is longer than 6 characters
  • The string contains any non-numeric character, except for the first character which can be a minus sign (-)
  • The numeric value is less than -32768 or greater than +32767

Parsing rules for VAL%()

The VAL%() function is hardwired to the equivalent function in BASIC ROM, please refer to this page for parsing rules.