Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!ucbvax!SUN.COM!wmb From: wmb@SUN.COM (Mitch Bradley) Newsgroups: comp.lang.forth Subject: Other interpreted control structures Message-ID: <8912301510.AA00672@jade.berkeley.edu> Date: 29 Dec 89 23:02:28 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Forth Interest Group International List Organization: The Internet Lines: 22 Here's a control structure that Don Hopkins and I came up with while were were doing a Forth command language for a schematic drawing system. This control structure combines the functions of FOR .. NEXT and IF .. ELSE .. THEN in a convenient way: n [ ... body ... ] \ body is execute n times if n > 0 n [ ... body ... ][ ... else ... ] \ Body is executed n times if n > 0, otherwise else clause \ is executed This is equivalent to IF ... ELSE ... THEN if n is 0 or 1 We found this syntax to be very pleasant for interactive use. The use of brackets for control structures is reminiscent of LaFarr Stewart's LaForth system. Mitch