help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to exit out of a function ? what is try-catch-throw in terms of


From: abhy
Subject: Re: How to exit out of a function ? what is try-catch-throw in terms of Program Counter
Date: Sun, 21 Oct 2007 09:07:33 -0700
User-agent: G2/1.0

On Oct 21, 1:45 am, gnuist...@gmail.com wrote:
> I have some code like this:
>
> (if  (test)
>     (exit)
>     (do something))
>
> or
>
> (if (test)
>    ( do something)
>    (exit))
>
> Various levels of nestings.
>
> I have several questions, basic to sophisticated.
>
> (1) What is the lisp equivalent idiom for (exit) as in bash or
> in C.
> (2) What is the best practice to handle this kind of problems?
>
> (3) What is the intermediate practice to handle this kind of
> problems.
>
> NOTE: I am really afraid of try-catch-throw. I have never been
> able to understand it since it does not exist in C and I cant
> really visualize the construct in terms of C. That is what my
> brain can process. If you understand it so well, you can show
> me how one would really implement that kind of construct in
> C and then by extension I can see that kind of program flow
> in LISP. Whether its imperative programming or functional,
> beneath there is program counter and assembly. C is close
> to machine so much that it is almost assembly. So understanding try-c-
> t in C is equivalent to understanding at
> the level of machine language.
>
> I therefore take the liberty to crosspost in C and C++ groups.

ok i guess we coudl write this one like as below.

if(test)
   do something

else
  exit


does this solve u r problem..?
If u want to exit from program exit is the keyword..if u want to break
from loops break is the key word.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]