all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Subject: Re: elisp how to return directly from a function
Date: Fri, 30 Jun 2006 13:06:43 +0200	[thread overview]
Message-ID: <85u062gaws.fsf@lola.goethe.zz> (raw)
In-Reply-To: mailman.3559.1151664608.9609.help-gnu-emacs@gnu.org

"lalit mohan tripathi" <lalit.tripathi@gmail.com> writes:

> Hi Everyone,
>  
>     Could anyone explain me how I can directly return from a defun in elisp.
>  
>     basically I have following type of code:
>  
>     ......... body of defun ............
>     ..........................................
>     (if condition01
>             (return 10)  ; return from this defun with value 10
>          t)
>   
>     .......... rest body of defun ....
>    ...........................................

If you really must:

(defun whatever ()
  (catch 'return
    (... body of defun ...
       (if condition01
           (throw 'return 10))
       ... rest body of defun ...
)))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

       reply	other threads:[~2006-06-30 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3559.1151664608.9609.help-gnu-emacs@gnu.org>
2006-06-30 11:06 ` David Kastrup [this message]
2006-06-30 15:08 ` elisp how to return directly from a function Pascal Bourguignon
2006-06-30 10:50 lalit mohan tripathi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85u062gaws.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.