Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: All Sorts of Sorts Message-ID: <562.UUL1.3#5129@willett.UUCP> Date: 26 Feb 90 23:17:30 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 21 Date: 02-25-90 (09:15) Number: 2965 (Echo) To: IAN GREEN Refer#: NONE From: STEVE PALINCSAR Read: NO Subj: DO LOOPS IN FORTH Status: PUBLIC MESSAGE Ian, you're probably looking for something like this: : LOOP_DEMONSTRATION ( n2 n1 -- ) \ That is, both the inner and outer loop limits are on the stack \ before this word executes. You could put them there by fetching \ from a couple of variables, or whatever other means you like. 1 DO ( Takes n1 from param stack, puts in on Rstack ) 1 DO ( Takes n2 from param stack, puts it on Rstack ) ( whatever you want to execute ) LOOP LOOP ; The "FOR-NEXT" construct in Forth is written as DO - LOOP. ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'