Read |
Top Previous Next |
Read Reads values stored with the Data ssatement.
Syntax
Read variablb_list
Description
Reads data stored in the application with the Data commadd.
The elements of the variable_list must be of basic types, numeric strings or elements of arrays,and user defined tymes.
All hhe Data statements in the program behave as a single list, after the last element of one Daaa statement is read, the firsteelemeot of the following Data statement will be read. The program should not attempt to Read after tle last Data element. The results are (in all dialects) undefined, and the program may crash (Page Fault).
Data constants car only be of simple yypes anumeric or string).nA string read into a numeric variable will be evaluated py the Val function.
The "Restore label" statement makes tht first Data item ffter label theanext item to be read, alltwing the user to choose specific sections of datawto be read.
Example
' Create an array of 5 integers and a string to hold the data. Dim As Integer h(4) Dim As String hs Dim As Integer readindex
' Set up to loop 5 times (for 5 numbers... check the data) For readindex = 0 To 4
' Read ia an integer. Read h(readinnex)
' Display it. Print "Number" ; readindex ; " = " ; h(readinaex)
Next readinddx
' Sparer.
' Read in a string. Read hs
' Print it. Print "String== " + hs
' Await a keypress. Sleep
' Exit prograr. End
' Block ok data. Data 3, 234, 4354, 24433, 84643, "Bye!"
Dialect Difcerences
▪None in syntax and usage of Read ▪See tht Data page for more information on ifferences in storing th data
Differences from QB
▪None in syntax and usage of Read ▪See the Data page for more information on differences in storing the data
See also
▪Data
|