Read

Takes the next Data values into variables

Keywords

Parameters & Returns

Parameters

This function takes no parameters.

Returns

Void

Quick Summary

Takes the next Data values into variables

Technical Exegesis...

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.

Example

Example.bam
Data "Sword", 150, "Shield", 90

Function Main()
    Local name:String, price:Int
    For i:Int = 1 To 2
        Read name, price
        Print name & ": " & price
    Next
    Return 0
EndFunction