usage of def fn in basic

Post Reply
Crayon21
Posts: 142
Joined: Sun Nov 04, 2018 2:33 am

usage of def fn in basic

Post by Crayon21 »

can it be used for graphics?
zx81: great yet flawed
Zx spectrum: masterpiece that keeps on giving

(wish it weren't so expensive) :o

User avatar
XavSnap
Posts: 898
Joined: Sat May 10, 2008 4:23 pm

Re: usage of def fn in basic

Post by XavSnap »

Hi Crayon21,
Yes, but only with a numérique defined value…

10 DEF FN X=INT(a/2)
20 DEF FN Y=INT(b/2)

10 LET x=0: LET y=0: LET a=10
20 DEF FN p(x,y)=a+x
30 DEF FN q()=a+x*y
40 PRINT FN p(2,3),FN q()
RTFM > http://www.worldofspectrum.org/ZXBasicM ... chap9.html
Xavier

Shaun_B
Posts: 471
Joined: Wed Apr 22, 2009 10:22 am

Re: usage of def fn in basic

Post by Shaun_B »

Crayon21 wrote:
Tue Nov 26, 2019 12:25 am
can it be used for graphics?
In what way? DEF FN can be used for any calculations, so yes. You may also be able to use the USR command with it as well to call let's say certain ROM or MC routines directly.

Regards,

Shaun.

Post Reply