Open udhos opened 5 years ago
"Error in DEF FN: Expected FN after DEF" means:
gobasic
expects something like:
DEF FN blah(arg) = arg * arg
Instead it received something without FN:
DEF ....
If you look at the sample code you posted you'll see:
470 DEF FND(D)=SQR((K(I,1)-S1)^2+(K(I,2)-S2)^2)
475 DEF FNR(R)=INT(RND(R)*7.98+1.01)
DEF FNR..
!= DEF FN ...
Got it, thanks!
Do you think that gobasic could support both modes? FN A() and FNA() ? See example below.
Code:
$ more fn.bas
10 DEF FNA(X)=X*X
20 DEF FN B(X)=X*X*X
30 PRINT "fna(2)=";FNA(2)
40 PRINT "fn b(2)=";FN B(2)
Output:
fna(2)= 4
fn b(2)= 8
That would be a harder change than I'd like; since the parse would need to know that "FNA
" was not the identifier "FNA
" but instead two tokens "FN
+ A
"..
gobasic is reporting error for this program. How can I find the root cause?
Full source code: https://github.com/udhos/basgo/blob/master/examples/trek/superstartrek.bas