53 of 208
ZBasic Language Reference 45 ZX Microcontroller Family &B or &b prefix). In the latter case, an underscore may exist between any pair of digits. For real types, the data values may be expressed in integral, decimal or scientific notation format. See the ValueS() System Library routine for a description and examples of the acceptable formats of values. For string types, the data values should be zero or more characters enclosed in quotation marks. To include a quotation mark in the string it must appear twice in succession. For the one-dimensional types, one or more values may be specified per line. When multiple values are given per line they must be separated by a comma and/or white space (space or tab characters). The first value on a line may be preceded by white space. Following the last value on a line, there may be a comma and/or white space and/or a comment (introduced by an apostrophe). The number of elements in the vector will be exactly the number of properly formatted data values in the file. For the two-dimensional types, the values for each row of the table must be placed on a separate line. The column values on each line must be separated by a comma and/or white space. A comment may follow the last column value on a line. The number of valid column values must be the same for each row. For either type, the initialization data file may contain blank lines and lines containing only a comment optionally preceded by white space. For the Byte types, data values may also be specified using a quoted string. In this case, the ASCII value of each character of the string is used as a data value. As usual, a quote may be included in the string by using two quotes in succession. For the string types, values may be specified by concatenating strings and/or byte values by separating each pair of components with a plus sign. The examples below include samples of each of these special cases. The second method to provide initialization data is to use an in-line initializer that consists of a pair of curly braces bracketing the initialization data itself. The form of the in-line initializer data is essentially the same as the content of the initialization file described above but appearing between curly braces directly in your source file. Here is an example of the content of an initialization file for a ByteVectorData type: ' this is a data file &H55 2 ' comment 3 4, 5 ' another comment 5, &Haa Below is an example of the initialization data for a SingleTableData type: .30103, 3.14159 ' log of 2 and pi -200., 1e05 +6.02E+23 100 Here are examples of in-line initializers for one-dimensional and two-dimensional types. Dim d1 as ByteVectorData({ 20, &Hff, &H20, "row" }) Dim strList as StringVectorData({ "alpha", "bravo", "charlie", "delta", "echo", "fox" + &H5f + "trot" }) Dim tbl as New SingleTableData({ ' column 1 column 2 .30103, 3.14159 -200., 1e05 +6.02E+23, 100 })