As pointed out earlier, there is no function capability in NTB. The only case where this occurs is with @, and that's bolted on in a messy way to factor().
The difference between a statement and a function is that the first takes one or more parameters, executes, and returns the address of the next line to execute. That allows both linear execution and recursion, which is used when control statements are nested. A function takes one or more parameters and returns a value... it seems to me that that a function is only useful as part of an assignation statement:
Code: Select all
1000 a = usr 57554, 55DATA is easy; it's a statement that does the same as a comment: nothing.
READ with a line number should return the first data item from that line; without a line number it should return successive data items.
Proposed changes, then:
- define the DATA statement
- add a new 'is' function: is_a_function() which will return true if the character tested is a function token, or @ (which is a function, but saves memory by not needing a table/enum entry).
- change assignment() to test for and expect a function return value which it can save before moving to the next line.
Code: Select all
100 print read 1000Code: Select all
100 a = read 1000
110 print aNeil