From reading my trusty T/S 1000 User Manual last night I came across the sentence, "Sinclair BASIC lacks user-defined functions".
This was a bit of a surprise to me. I was trying to decide how difficult that would make things.
Not sure, but it could make things more challenging in some respects.
If you have function - func(y)
10 let x = func(10)
Assume the code for the function starts at line 1000, this is how you would run it:
let y = 10
you would just make sure that the function would set the results into variable X,
or it could change the value of Y to be the return value.
I've seen some example programs where they will do this:
let func = 1000
and then do
User Manual page 191:johnnyrockets wrote:From reading my trusty T/S 1000 User Manual last night I came across the sentence, "Sinclair BASIC lacks user-defined functions.
User Manual page 44:ZX81 BASIC lacks READ, DATA & RESTORE (but see exercise 3 of chapter 22 concerning this), user-defined functions (FN & DEF; but VAL can sometimes be used), & multi-statement lines.
This is Applied to a string, & the result is its length. For instance LEN "CHEESE" = 6.
This applied to a string, & the result is what that string gives when evaluated as an arithmetic expression. For instance (if A = 9), VAL "1/2+SQRA" = 3.5. If the string to which VAL is applied contains variables, then two rules must be obeyed.
If the VAL function is part of a larger expression, it must be the first item; e.g. 10 LET X = 7+VAL "Y" must be changed to 10 LET X = VAL "Y" +7.
VAL can only appear in the first coordinate of a PRINT AT, PLOT or UNPLOT statement (see Chapter 17 and 18) e.g. 10 PLOT 5, VAL "X" must be changed to
10 LET Y = VAL "X" 15 PLOT 5, Y
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube