[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 20:01:31 +0200 |
Noted Nick. Thank you.
---------------------
Christopher Dimech
Chief Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy
> Sent: Wednesday, October 07, 2020 at 7:29 PM
> From: "Nick Dokos" <ndokos@gmail.com>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Executing part of the code instead of another
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > I have tried executing the following condition (if (nb > na))
> >
> > (setq na 2)
> > (setq nb 5)
> > ( if (> nb na)
> > (message "nb > na [condition true]")
> > (message "condition false")
> > )
> >
> > I highlighted the region then pressed C-x C-e
> > It returned the first message as expected, but when I tried
> > the next one, I still got the first message.
> >
> `C-x C-e` is bound to `eval-last-sexp` which evaluates the *last*
> sexp: the if. It does not evaluate the setq's (setting the region does
> *NOT* matter for it - try `M-x eval-region' for that)
>
>
> > (setq na 2)
> > (setq nb 1)
> > ( if (> nb na)
> > (message "nb > na [condition true]")
> > (message "condition false")
> > )
> >
> >
> >
> >
> >> Sent: Wednesday, October 07, 2020 at 9:20 AM
> >> From: "Robert Pluim" <rpluim@gmail.com>
> >> 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, 7 Oct 2020 09:01:00 +0200, Christopher Dimech
> >> >>>>> <dimech@gmx.com> said:
> >>
> >> Christopher> What can one use if there is an else branch with multiple
> >> commands, as I would
> >> Christopher> like to use it.
> >>
> >> From 'C-h f if'
> >>
> >> if is a special form in `C source code'.
> >>
> >> (if COND THEN ELSE...)
> >>
> >> Probably introduced at or before Emacs version 1.1.
> >>
> >> If COND yields non-nil, do THEN, else do ELSE...
> >> Returns the value of THEN or the value of the last of the ELSE's.
> >> => THEN must be one expression, but ELSE... can be zero or more
> >> expressions.
> >> If COND yields nil, and there are no ELSE's, the value is nil.
> >>
> >>
> >> Robert
> >> --
> >>
> >
> >
>
> --
> Nick
>
> "There are only two hard problems in computer science: cache
> invalidation, naming things, and off-by-one errors." -Martin Fowler
>
>
>
- Executing part of the code instead of another, Christopher Dimech, 2020/10/06
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/06
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/06
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/06
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Nick Dokos, 2020/10/07
- Re: Executing part of the code instead of another,
Christopher Dimech <=
- Re: Executing part of the code instead of another, Gregory Heytings, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Stefan Monnier, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, tomas, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07