Closed goldnchild closed 2 years ago
Hi, you're using an old version, please use the latest release (which doesn't have this issue).
Yes, trying with ubuntu 22.04 which has version 2.0.4-3 works fine.
A workaround is just to use a unique identifier that doesn't match the program's variables, like DEF FN myfunc(xarg0) instead of just DEF FN myfunc(x)
Thanks again for your pcbasic program. There's nothing like hacking out a little program in basic.
Bug report
Problem
According to the manual,
DEF FN[ ]name [(arg_0 [, arg_1] ...)] = expression
Defines a function called [FN] name (or FN name: spaces between FN and name are optional). On calling FNname( ... ), expression is evaluated with the supplied parameters substituted. Any variable names used in the function that are not in the argument list refer to the corresponding global variables.
Program
100 DEF FN MYNOT(X)=(X=0)*-1 110 FOR X = 1 TO 100 : PRINT X, FN MYNOT(20) : NEXT
this will print 21 0 continuously.
Crash log
Notes
PC-BASIC version: 2.0.2 Operating system version: ubuntu 20.04