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

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

Re: Executing part of the code instead of another


From: Christopher Dimech
Subject: Re: Executing part of the code instead of another
Date: Wed, 7 Oct 2020 16:05:01 +0200

Thank you so very much Tomas. Ok. Got It.


> Sent: Wednesday, October 07, 2020 at 4:01 PM
> From: tomas@tuxteam.de
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: moasenwood@zoho.eu, help-gnu-emacs@gnu.org
> Subject: Re: Executing part of the code instead of another
>
> On Wed, Oct 07, 2020 at 03:48:51PM +0200, Christopher Dimech wrote:
> > It would be better if you explain to me this progn stuff
> >
> > Have tried an example like this
> >
> > (setq na 8)
> > (setq nb 13)
> > ( if (> nb na)
> >     progn (
> >       (message "nb > na condition [condition is true]")
> >       (message "nb > na condition [condition is true]")
> >     )
>
> No. Written in Lisp, it's
>
>   (progn
>     (thing 1)
>     (thing 2)
>     ...)
>
> In C (and in conventional maths, you'd write it as you did
> above).
>
> Note that it's the same way as you write (message "foo")
> [you don't write message("foo"), as you'd do in C or
> Python or what not).
>
> Progn is a form to bundle a sequence of forms, which are
> evaluated one after the other. The value of progn is
> that of the last form evaluated (that's the -n), as opposed
> to prog1, which would do the same as progn, but return the
> value of its first form.
>
> Cheers
>  - t
>



reply via email to

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