@@ -213,7 +213,7 @@ Program terminated
213213### Statement structure
214214
215215As per usual in old school BASIC, all program statements must be prefixed with a line number which indicates the order in which the
216- statements may be executed. A statement may be modified or
216+ statements may be executed. There is no renumber command to allow all line numbers to be modified. A statement may be modified or
217217replaced by re-entering a statement with the same line number:
218218
219219```
@@ -389,6 +389,40 @@ Proper error handling is provided:
389389- ** OUT OF DATA** : When there are no more DATA items to read
390390- Index validation occurs BEFORE consuming DATA items
391391
392+ #### Array Support in READ
393+
394+ The ** READ** statement now supports reading data directly into array elements, using expressions for array indices:
395+
396+ ```
397+ > 10 DIM A(5)
398+ > 20 DIM N$(3)
399+ > 30 DATA 10, 20, 30, "Hello", "World"
400+ > 40 READ A(1), A(2), A(3), N$(1), N$(2)
401+ > 50 PRINT A(1); A(2); A(3); N$(1); N$(2)
402+ > RUN
403+ 102030HelloWorld
404+ >
405+ ```
406+
407+ Array indices can be complex expressions including variables and arithmetic:
408+
409+ ```
410+ > 10 DIM B(10)
411+ > 20 I = 2
412+ > 30 DATA 100, 200
413+ > 40 READ B(I*3), B(I+4)
414+ > 50 PRINT "B(6)="; B(6) REM Shows 200 (second value overwrites first)
415+ > RUN
416+ B(6)=200
417+ >
418+ ```
419+
420+ Proper error handling is provided:
421+ - ** SUBSCRIPT ERROR** : When array indices are out of bounds or negative
422+ - ** OUT OF DATA** : When there are no more DATA items to read
423+ - Index validation occurs BEFORE consuming DATA items
424+
425+
392426### Comments
393427
394428The ** REM** statement is used to indicate a comment, and occupies an entire statement. It has no effect on execution:
@@ -1230,11 +1264,8 @@ a subroutine call, or program termination. This paradigm of using the parser to
12301264object to make control flow decisions and to track execution, and a signalling mechanism to allow the parser to signal
12311265control flow changes to the Program object, is used consistently throughout the implementation.
12321266
1233- ## Open issues
1267+ ## Python Basic feature
12341268
1235- * It is not possible to renumber a program. This would require considerable extra functionality.
1236- * Negative values are printed with a space (e.g. '- 5') in program listings because of tokenization. This does not affect functionality.
1237- * User input values cannot be directly assigned to array variables in an ** INPUT** or ** READ** statement
12381269* Strings representing numbers (e.g. "10") can actually be assigned to numeric variables in ** INPUT** and ** READ** statements without an
12391270error, Python will silently convert them to integers.
12401271
0 commit comments