[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My First Computer
"Paul Schlyter" <pausch@saaf.se> wrote in message...
> > Funny, one of the things that made Applesoft click for me was the line
> > numbering combined with the GOTO statement.
> >
> > 10 PRINT "HELLO"
> > 20 GO TO 10
> >
> > That's graspable on a purely intuitive level (at least for me), whereas
> > other languages that I'd previously attempted (applescript, metal, real
> > basic, etc) seemed much less obvious.
> >
> > Well, I may not be a 'programmer' per se, but I have written quite a few
> > short programs that I find quite useful, and by golly I do use alot of
> > GOTOs.
>
> You could write spaghetti programs in a lot of other languages too.
> Your program above would, in C, become:
>
> main()
> {
> again: printf( "Hello\n" );
> goto again;
> }
>
> but of course virtually any actual C programmer would prefer this:
>
> main()
> {
> for(;;)
> printf( "Hello\n" );
> }
>
> That too will produce an endless loop.
I like this one:
BEGIN
REPEAT
WRITELN('Hello');
DELAY(1);
UNTIL KEYPRESSED;
END.
except the keypress requires a bit of pressing down.
Ross.