Loading ...
Sorry, an error occurred while loading the content.

Re: [midatlanticretro] Re: BASIC drag race

Expand Messages
  • Jim Scheef
    Hello all, I know I shouldn t do this, but... Someone already mentioned that there are differences in BASIC interpreters. This program may be doing different
    Message 1 of 10 , Apr 21, 2005
    • 0 Attachment
      Hello all,

      I know I shouldn't do this, but...

      Someone already mentioned that there are differences in BASIC interpreters.
      This program may be doing different things on each computer.

      10 - sets k to zero
      20 - sets k to one and initializes the for-next loop to stop when k is 999
      30 - increments k by one
      40 - marks the end of the loop AND (in most interpreters) increments k by one
      50 - prints a message

      I think this program is only performing half of the iterations intended by
      the author. Now in a loop this short and running on these machines, I doubt
      this will make much difference in execution time. If the machines have
      clocks, it might be nice if the program printed that start and finish times.

      Some interpreters might not stop if k somehow never hits 999 and skips to
      1000. Most BASIC implementations do not require that variables be defined
      before they are used so long as the first use assigns a value. Thus line 10
      is superfluous, but line 30 is not redundant.

      All of this could be used to wile away some hours in testing for differences
      between the two machines. Try a print statement within a shorter loop to see
      how the for-next works, etc.

      Jim


      --- billdeg@... wrote:
      > all true...the point is that we were running a simple BASIC program to add
      > numbers with the intent on seeing whose computer was faster. In our case
      > the code worked fine. I love it that we are discussing the finer points of
      > BASIC. It's been 16 years since I was paid to write in BASIC. :-)
      > Bill
      >
      > -----Original Message-----
      > From: Evan <evan947@...>
      > To: midatlanticretro@yahoogroups.com
      > Sent: Wed, 20 Apr 2005 14:20:24 -0400
      > Subject: RE: [midatlanticretro] Re: BASIC drag race
      >
      >
      > I agree. I also agree with the previous comments about it being good
      > practice to define variables, but with (k= 1....) in line 20, that gets
      > defined anyway.
      >
      > Then again, my programming knowledge isn't much more advanced than this
      > simple interperted BASIC code...
      >
      >
      >
      >
      > From: midatlanticretro@yahoogroups.com
      > [mailto:midatlanticretro@yahoogroups.com] On Behalf Of David V. Corbin
      > Sent: Wednesday, April 20, 2005 2:14 PM
      > To: midatlanticretro@yahoogroups.com
      > Subject: RE: [midatlanticretro] Re: BASIC drag race
      >
      >
      > In fact line #10 is BAD and may confuse many versions of basic... NEVER
      > modify the index of a for loop inside the loop...
      >
      > -----Original Message-----
      > From: midatlanticretro@yahoogroups.com
      > [mailto:midatlanticretro@yahoogroups.com] On Behalf Of Ray Sills
      > Sent: Wednesday, April 20, 2005 9:02 AM
      > To: midatlanticretro@yahoogroups.com
      > Subject: Re: [midatlanticretro] Re: BASIC drag race
      >
      >
      > Hi Gang:
      >
      > I don't think line 10 is needed either, since the for-next loop assigns
      > values to k. Of course, it -is- good programming form to declare a
      > variable at the beginning of a routine, and assign a zero or null
      > value.
      >
      > 73 de Ray
      > K2ULR
      > FN20tl
      > On Apr 20, 2005, at 8:04 AM, billdeg@... wrote:
      >
      > > Yes, this will work, but I should have removed line 30, it's redundant.
      > > Bill
      > >
      > > In a message dated 4/19/2005 10:47:01 PM Eastern Standard Time,
      > > ahm@... writes:
      > >
      > > > > 10 k=0
      > > > > 20 for k = 1 to 9999
      > > > > 30 k = k+1
      > > > > 40 next k
      > > > > 50 print k " - done!"
      > > >
      > > > Does this even work?
      > > > Nasty things tend to happen when you change loop variables on the
      > > fly.
      > >
      > > Yahoo! Groups Links
      > > ��� To visit your group on the web, go to:
      > > http://groups.yahoo.com/group/midatlanticretro/
      > >
      > > ��� To unsubscribe from this group, send an email to:
      > > midatlanticretro-unsubscribe@yahoogroups.com
      > >
      > > ��� Your use of Yahoo! Groups is subject to the Yahoo! Terms
      > of
      > > Service.
      > >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      > To visit your group on the web, go to:
      > http://groups.yahoo.com/group/midatlanticretro/
      >
      > To unsubscribe from this group, send an email to:
      > midatlanticretro-unsubscribe@yahoogroups.com
      >
      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.