[gnu.emacs] do-while loop in Emacs Lisp?

montnaro@sprite.crd.ge.com (Skip Montanaro) (11/12/89)

I need a do-while construct in Emacs Lisp. The only thing I can think of is

	(catch 'loop
	    (while t

		... loopy stuff here ...

		(if exit-condition-met
		    (throw 'loop t))))

Is that the logical way to do it?

--
Skip Montanaro (montanaro@crdgw1.ge.com)

merlyn@iwarp.intel.com (Randal Schwartz) (11/13/89)

In article <MONTNARO.89Nov11111152@sprite.crd.ge.com>, montnaro@sprite (Skip Montanaro) writes:
| I need a do-while construct in Emacs Lisp. The only thing I can think of is
| 
| 	(catch 'loop
| 	    (while t
| 
| 		... loopy stuff here ...
| 
| 		(if exit-condition-met
| 		    (throw 'loop t))))
| 
| Is that the logical way to do it?

As usual, there are probably a zillion ways to do it.  One that I like
is:

(while (progn
	 body-1
	 body-2
	 ...
	 body-n
	 test-condition))

Works just fine.

Just another Elisp hacker (when I'm not wailing on Perl),
-- 
/== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\
| on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III  |
| merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn	         |
\== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/