Table of Contents

ugBASIC User Manual

READ ✓

SYNTAX

   READ var

PURPOSE

The READ is used for reading constant values from DATA lines into the given variables. This command is able to read more constants at once with a variable list separated by commas.

If using the wrong type of variable (for example read a character string into a numerical variable like float or integer), the variable will be untouched. Such behavior can be prevented by generally using a variable of the same type like the DATA AS used.

With a value that falls outside the expected range of a READ variable, e.g. the value is outside the range of an integer, ugBASIC will implicitly convert it, with a precision lost, but only if SAFE keyword is used. If more constants are read than values exist in DATA lines, garbare will be read. It can be avoided by using SAFE keyword or using READ END function. Using SAFE the variable will not be touched if last value is already read.

A succeeding READ searches for the first DATA statement where the DATA read pointer is adjusted to.

EXAMPLE

  READ nextStep

See also the following example files:

ABBREVIATION

 R#

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY