[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"break" and "continue" in Emacs Lisp
From: |
Herbert Euler |
Subject: |
"break" and "continue" in Emacs Lisp |
Date: |
Wed, 07 Dec 2005 21:44:09 +0800 |
Hello,
I don't know how to write an Emacs Lisp program that's equal
to the following C program, because of break and continue:
i = 0;
while (i++ < 100)
if (i == 25)
continue;
else if (i == 75)
break;
For break, I now write it in this way:
(let ((i 0))
(while (and (< i 100) (not (eq i 75)))
() ; operations here
(setq i (1+ i))))
Perhaps catch and throw also work.
For continue, this can work:
(let ((i 0))
(while (< i 100)
(if (not (eq i 25))
() ; operations here
())
(setq i (1+ i))))
I don't think this is clear and straightforward. Is there any better
solution? Is there no goto in Emacs Lisp?
Thanks in advance.
Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
- "break" and "continue" in Emacs Lisp,
Herbert Euler <=