Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
GETVARR Function
GETVARR(string-expression)

Retrieves the value of a real (floating-point) variable by its name. If the variable does not exist, an error is thrown. Use EXISTSVARR to check for existence without triggering an error.


Examples

REM Define a real variable
temperature# = 21.5
REM Retrieve it by name
PRINT GETVARR("temperature#")

Produces 21.5.

REM Attempting to get a missing variable
PRINT GETVARR("doesnotexist#")

Raises an error.

REM Safe access using EXISTSVARR
IF EXISTSVARR("speed#") THEN
PRINT "Speed = "; GETVARR("speed#")
ELSE
PRINT "Speed not defined"
ENDIF

Notes

  • The string must exactly match the variable name, including the # suffix for real variables.
  • If the name refers to a variable of a different type (integer or string), an error is raised.
  • Returns a 64-bit double-precision floating-point value.

See also: GETVARI · GETVARS$ · EXISTSVARR