BASIC vs Python

Fredrik Lundh fredrik at pythonware.com
Fri Dec 17 16:00:14 CET 2004


Richards Noah wrote:

>> You had recursion with BASIC --what you probably mean is that you had no
>> stacked parameters (unless you imitated that with using an indexed
>> array).
>>
>> 90 rem recursion
>> 100 print "beautiful colours"
>> 110 gosub 100
>
> I think he means that you had no recursive function calls in BASIC.  I
> suppose, to most of us, "recursion" doesn't mean "doing things more than
> once," since by that definition, iteration is also recursion.  Recursion
> generally means some type of self reference

Note that he uses gosub, not goto.  The code block that starts at line 100
and ends at line 110 calls itself recursively.  Works just fine in many (most?)
BASIC implementations (at least until you run out of call stack).

(the original BASIC was a different thing, though: quoting from the 1964 hand-
book: "the user must be very careful not to write a program in which GOSUB
appars inside a subroutine which itself is entered via a GOSUB; it just won't
work".  The handbook also states that the program size is limited to "two feet
of teletype paper"...)

</F> 






More information about the Python-list mailing list