10 rem logfun.bas - logical functions
 20 rem fna - AND
 30 rem fno - OR
 40 rem fnn - NOT
 50 def fna(p,q)=-1*p*q
 60 def fno(p,q)=sgn(p+q)
 70 def fnn(p)=-1*p-1
 80 print "P","Q","P AND Q","P OR Q","NOT P"
 90 for i=0 to -1 step -1
100   for j=0 to -1 step -1
110     print i,j,fna(i,j),fno(i,j),fnn(i)
120   next j
130 next i
140 end