[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Noob question -- On error, exit function and terminate script
- From: Xavier Wang <weasley.wx@...>
- Date: Sun, 26 Jun 2011 00:45:12 +0800
在 2011-6-26 半夜12:41,"steve donovan" <steve.j.donovan@gmail.com>写道:
>
> On Sat, Jun 25, 2011 at 6:18 PM, Xavier Wang <weasley.wx@gmail.com> wrote:
> > Sorry, but I mean, a new version of assert against the baselib one that
> > _don't_ evaluate the second _expression_ if the first _expression_ is true.
>
> That is difficult because assert() is a function, not a macro like in C.
>
> It's a pity that expressions cannot be statements, e.g. the _expression_
>
> 1 == 0 or error_fn()
>
> works as we want: error_fn() is only called if the first condition fails.
Thank you! That is new to me, and very useful!!
- References:
- Noob question -- On error, exit function and terminate script, marbux
- Re: Noob question -- On error, exit function and terminate script, Rebel Neurofog
- Re: Noob question -- On error, exit function and terminate script, Xavier Wang
- Re: Noob question -- On error, exit function and terminate script, Timothy Hunter
- Re: Noob question -- On error, exit function and terminate script, Xavier Wang
- Re: Noob question -- On error, exit function and terminate script, steve donovan