Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: "short circuiting" And and Or

  • To: mathgroup at
  • Subject: [mg70632] Re: "short circuiting" And and Or
  • From: "Jens-Peer Kuska" <kuska at>
  • Date: Sat, 21 Oct 2006 05:14:38 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <eha5b7$b5b$>


something like

If[TrueQ[#], Throw[$Failed], Print[#]] & /@

   {False, a, b, False, True, True,True}



"Szabolcs Horvat" <szhorvat at> schrieb im 
Newsbeitrag news:eha5b7$b5b$1 at
| I'd like to write a function that tests whether 
there are any elements
| in a list that violate a certain condition. I 
could simply use
| And@@condition/@list, but for reasons of 
efficiency I'd like to stop
| the testing as soon as a "False" value is found. 
Is there any elegant
| way of doing this without writing an explicit 
While loop?
| Szabolcs Horvát

  • Prev by Date: Re: Re: Infinity vs DirectedInfinity[1]
  • Next by Date: Re: Display glitch: \[ImaginaryI] appears as just "i"
  • Previous by thread: Re: "short circuiting" And and Or
  • Next by thread: Re: "short circuiting" And and Or