Goto

Neil Cerutti horpner at yahoo.com
Sun Jun 17 06:41:50 EDT 2007


On 2007-06-17, Tina I <tinaweb at bestemselv.com> wrote:
> Back then I took a course in structured BASIC programming (now
> there is a contradiction in terms) and the instructor warned
> about goto time and time again. But his biggest mistake was to
> tell us that if we had to use goto at least we should explain
> it in a comment. So we would turn in programs with sections
> like:
>
> 100 IF S$="YES" THEN GOTO 150
> 110 REM Go to line 150 if S$ is Yes

Once I learned GOSUB (in Commodore BASIC) I used it instead of
GOTO all the time. I used it for functions long before I learned
about functions in Programming 101.

100 NAME$="TED"
110 AGE=40
120 GOSUB 1000


1000 PRINT NAME$, " IS ", AGE, " YEAR(S) OLD."
1010 RETURN

Named functions are so much nicer than numbered ones.

-- 
Neil Cerutti



More information about the Python-list mailing list