Computers for children

From: Uncle Roger <sinasohn_at_ricochet.net>
Date: Thu Jan 14 15:59:37 1999

At 10:24 PM 1/12/99 -0500, you wrote:
>What I meant was, in the early BASICs, you would have to type out the FOR
>loop with a variable, an increment, a conditional statement, and a goto.

Every BASIC I've ever used had a for-next construct as follows:

FOR variable = start TO end [BY inc]
  commands
NEXT [variable]

No GOTO was ever needed. However, it is just a simplified version of a
combination IF and GOTO.

>easier to understand that the NEXT X must be going back to that FOR X= 1
>TO 10 I saw a while ago, as opposed to scrolling incessantly trying to
>find where each GOTO leads.

For-Next is pretty basic (pun intended). Do While/Do Until is not found in
earlier BASIC's; perhaps that's what you were thinking of? Nonetheless,
Using IF and GOTO to simulate a For-Next loop does not mean lots of
searching for GOTO destinations -- if you are a good programmer, it doesn't.

>I don't know exactly at what point the FOR...NEXT gets translated into its
>components, but the point is, since it doesn't have to be typed out, it's
>somewhat lower-level.

For-Next is interpreted when executed. It is at that point that the
relevant machine language instructions are generated and executed. Machine
language is low-level, C is slightly higher, BASIC is definitely
high-level, things like Powerhouse and other 4GL's are even higher levels
of extraction.
Received on Thu Jan 14 1999 - 15:59:37 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:32:06 BST