Takes the next value from the program's Data into a variable. Syntax is Read variable, or Read a, b, c for several at once. Plain variables, array elements and Type fields (obj\field) all work.
The value is converted to the variable's type: a number read into a String is the number as written (7 gives "7"), a string read into a number is its value (0 if it isn't a number), and a fraction read into an Int is cut down, as ToInt does.
Takes the next value from the program's Data into a variable. Syntax is Read variable, or Read a, b, c for several at once. Plain variables, array elements and Type fields (obj\field) all work.
The value is converted to the variable's type: a number read into a String is the number as written (7 gives "7"), a string read into a number is its value (0 if it isn't a number), and a fraction read into an Int is cut down, as ToInt does. Reading after the last value stops the program with "Out of data" and the line of the Read. Read must be inside a Function or Method. Use Restore to read again from the start or from a label.
Example
Example.bam
Data "Sword", 150, "Shield", 90Function Main()
Local name:String, price:Int
For i:Int = 1To2
Read name, price
Print name & ": " & price
NextReturn0
EndFunction