richpl / PyBasic

Simple interactive BASIC interpreter written in Python
GNU General Public License v3.0
170 stars 46 forks source link

INPUT into arrays #55

Open richpl opened 3 years ago

richpl commented 3 years ago

Placeholder to add support for user input directly into an array variable

cclauss commented 2 years ago

Would it be possible to provide an example of the BASIC syntax that should be supported?

RetiredWizard commented 2 years ago
     10 DIM A(10)
     20 FOR I = 1 TO 10
     30 PRINT "ENTER VALUE NUMBER ";I;
     35 REM *** THE FOLLOWING STATEMENT DOESN'T CURRENT WORK PROPERLY ***
     40 INPUT ": ";A(I)
     50 NEXT I
     60 PRINT "YOU ENTERED: ";
     70 FOR I = 1 TO 10
     80 PRINT A(I);", ";
     90 NEXT I
     100 PRINT
     >RUN
     ENTER VALUE NUMBER 1: 1
     ENTER VALUE NUMBER 2: 7
     ENTER VALUE NUMBER 3: 0
     ENTER VALUE NUMBER 4: 1
     ENTER VALUE NUMBER 5: 6
     ENTER VALUE NUMBER 6: 9
     ENTER VALUE NUMBER 7: 6
     ENTER VALUE NUMBER 8: 4
     ENTER VALUE NUMBER 9: 0
     ENTER VALUE NUMBER 10: 3
     YOU ENTERED: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

     *** SHOULD BE ***
     YOU ENTERED: 1, 7, 0, 1, 6, 9, 6, 4, 0, 3