[Color Computer] [Coco] Bug in FOR NEXT ?
Roger Taylor
webmaster at coco3.com
Sat Jun 3 11:43:30 EDT 2006
At 05:31 AM 6/3/2006, you wrote:
>On 6/3/06, Willard Goosey <goosey at virgo.sdc.org> wrote:
>> >Date: Thu, 1 Jun 2006 17:59:41 -0500
>> >From: Frank Pittel <fwp at deepthought.com>
>> >
>> >I always that the loop counter was "undefined" outside the loop.
>>
>>That's a Pascal-ism, actually.
>>
>>The thing that surprised ME when I ran across it in BASIC is that
>>FOR-NEXT loops always go through the loop at least once, even in cases
>>like:
>>10 A=0
>>20 FOR B=1 TO A
>>30 REM DO SOMETHING
>>40 NEXT B
>>
>>Willard
>>--
>Yes, it's not obvious that the test is made in the NEXT statement, not
>in the FOR statement. That's caught quite a few people. The Pascal
>"Repeat ... Until" and "While" statements make it a bit more obvious
>where the test is going to occur.
>
>Ken
Before the CoCo 3, I used to add my own commands to BASIC and Extended
BASIC. In fact, before I had an Extended BASIC CoCo, I would try to create
some of the ECB commands and add them to Color BASIC. If I could just
recover all of my old cassette tapes I would find stuff like this including
a huge set of commands I wrote that I would call Super BASIC or something
like that. In other words, my own custom set of BASIC commands that were
not available in any CoCo. Time has gone by and I've forgotten all of
them, but I had some neat ones.
I'm not sure if there is room in a CoCo 3 for more commands (if not, maybe
a few unused one could be overwritten), but it would be easy to add new
ones to BASIC and ECB/Disk BASIC.
Maybe somebody could create a REPEAT/UNTIL and WHILE/ENDWHILE set of
commands and offer this as a LOADMable binary or a BASIC program that does
the entire patch including the switch the all-RAM mode if needed, etc.
--
Roger Taylor
More information about the Coco
mailing list