In the following code is a Load function that I will use in a lib under development.

Code: Select all

```
'Load data
'by Ton Nillesen, November 2019
'load a section of data from a list into a series of variables
'
DIM List()=(0,1,2,3,4,5,6,7,8,9)
p=4
a,b,c,d,e,f=LoadN|6(List,6,p)
PRINT "a =";a
PRINT "b =";b
PRINT "c =";c
PRINT "....."
PRINT "f =";f
END
'
DEF LoadN(a(),N,i)
' return N values from a() starting at index i
' 0<N<=10
IF N=1 THEN RETURN a(i)
IF N=2 THEN RETURN a(i) a(i+1)
IF N=3 THEN RETURN a(i) a(i+1) a(i+2)
IF N=4 THEN RETURN a(i) a(i+1) a(i+2) a(i+3)
IF N=5 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4)
IF N=6 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5)
IF N=7 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6)
IF N=8 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7)
IF N=9 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7) a(i+8)
IF N=10 THEN RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7) a(i+8) a(i+9)
END DEF
'
[this does not work
DEF LoadN(a(),N,i)
' return N values from a() starting at index i
' 0<N<=10
ON N GOTO 1,2,3,4,5,6,7,8,9
1: RETURN a(i)
2: RETURN a(i) a(i+1)
3: RETURN a(i) a(i+1) a(i+2)
4: RETURN a(i) a(i+1) a(i+2) a(i+3)
5: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4)
6: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5)
7: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6)
8: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7)
9: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7) a(i+8)
10: RETURN a(i) a(i+1) a(i+2) a(i+3) a(i+4) a(i+5) a(i+6) a(i+7) a(i+8) a(i+9)
END DEF
]
```

"ON n GOSUB" does not work because then the RETURN values are not in the last RETURN statement.

Could the varianr "ON n GOTO ..." be added to the language?