TIP: Click on subject to list as thread! ANSI
echo: science
to: ALL
from: DAVID WILLIAMS
date: 2004-08-13 19:07:12
subject: Pythagorean triples

Path: number1.nntp.dca.giganews.com!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!zen.net.uk!dedekind.zen.co.uk!newsfeed.esat.net!news2.telebyte.nl!news.icp.pl!newsfeed.atman.pl!news.intercom.pl!f124.n480!f127.n480!f112.n480!f200.n2432!f605.n774!f500.n123!f514.n250!not-for-mail
Newsgroups: fido.science
Distribution: fido
From: DAVID WILLIAMS 
Date: Fri, 13 Aug 04 19:07:12 +0200
Subject: Pythagorean triples
Message-ID: 
Organization: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514
 111
 300
Lines: 42
Xref: number1.nntp.dca.giganews.com fido.science:313

->  -> sub delay (s) 
->  ->     for x=1 to s*18.6 
->  ->      t=timer 
->  ->      while t=timer 
->  ->      if inkey$  "" goto done 
->  ->      wend 
->  ->     next 
->  ->   done: 
->  -> end sub 
 
->  -> Jasen 
->  DW> 
->  DW> Isn't "s*18.6" arithmetic? 
->  DW> 
->  DW> More seriously - in some BASICs - you make it jump out of the loop if 
->  DW> a  key is pressed, without cleaning the FOR... information off the 
->  DW> stack.  Some BASICs will sort this out for you, but others won't, and 
->  DW> will lead  you into all kinds of tangles later. It would be better to 
->  DW> use EXIT FOR  than the GOTO. 
->  DW> 
->  DW> My $0.02 worth. 
 
-> The loop EXIT as you point out is an evolution and so is using DO/LOOP. 
 
->  M*i*k*e 
  
What's an "evolution"? Something that was invented after 1980? 
  
In pre-1980 BASIC, I guess one could write: 
  
T! = TIMER 
FOR X = 1 TO 2 
  IF TIMER < T! THEN T! = T! - 86400 
  IF TIMER >= T! + D! THEN X = 3 
  IF INKEY$ = "" THEN X = X - 1 
NEXT 
  
Something like that, anyway. The trick was to fiddle with the value of 
the counting variable (X, in this case), so as to make the loop 
terminate, or not. 
  
                                   dow 

SOURCE: echoes via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.