[Coco] What? No MOD?!

Rogelio Perea os9dude at gmail.com
Sun Dec 29 23:03:58 EST 2013


On Sun Dec 29 2013, William Astle wrote:

You can probably use DEFFN to simulate it. You'd need to involve the INT
> function and subtraction.
>

10 INPUT"NUMBERS TO MOD (A/B)";A,B
20 A=INT(A):B=INT(B) 'MAKING SURE BOTH ARE INTEGERS
30 DEF FNM(A,B)=A-INT(A/B)*B
40 PRINT A;"MOD";B;"IS"; FNM(A,B)
50 END

This typed from memory (late 40s and is starting to haze). Program will
probably run as is on a TRSDOS Model III and IV - not on cassette based
BASIC... and as noted by Chris Osborn, the CoCo ECB won't handle more than
one variable on the DEF FN statement *despite* the ECB manual calling for
'variables' on the review of it, plural but not quite - the simple DEF FN
examples on that book only show a one variable defined function. Better off
writing the thing as a subroutine in ECB.



More information about the Coco mailing list