Repository navigation
Read
Home › Miscellaneous Keywords › Read
Reads values stored with the Data statement.
Read variable_listReads data stored in the application with the Data command.
The elements of the variable_list must be of basic types, numeric, strings or elements of arrays and user defined types.
All the Data statements in the program behave as a single list, after the last element of one Data statement is read, the first element of the following Data statement will be read.
The program should not attempt to Read after the last Data element. The results are (in all dialects) undefined, and the program may crash (Page Fault).
Data constants can only be of simple types (numeric or string). A string read into a numeric variable will be evaluated by the Val function.
The "Restore label" statement makes the first Data item after label the next item to be read, allowing the user to choose specific sections of data to be read.
- None in syntax and usage of
Read - See the
Datapage for more information on differences in storing the data
- None in syntax and usage of
Read - See the
Datapage for more information on differences in storing the data
' 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 in an integer.
Read h(readindex)
' Display it.
Print "Number" ; readindex ; " = " ; h(readindex)
Next readindex
' Spacer.
Print
' Read in a string.
Read hs
' Print it.
Print "String = " + hs
' Await a keypress.
Sleep
' Exit program.
End
' Block of data.
Data 3, 234, 4354, 23433, 87643, "Bye!"Category: Miscellaneous Keywords
Kind: keyword
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing