Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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: How to tell Mathematica to stop conditional testing in an If statment if one condition is niether True or False? McCarthy evaluation rules? 'and then' test?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69585] Re: How to tell Mathematica to stop conditional testing in an If statment if one condition is niether True or False? McCarthy evaluation rules? 'and then' test?
  • From: Oliver Friedrich <xoliver.friedrich at tzm.dex>
  • Date: Sat, 16 Sep 2006 03:50:26 -0400 (EDT)
  • References: <eebfu3$5dt$1@smc.vnet.net>

"Nasser Abbasi" <nma at 12000.org> wrote in news:eebfu3$5dt$1
@smc.vnet.net:

> I can better describe this with simple example:
> 
> ------------- code ------------
> 
> Remove["Global`*"];
> xc = Table[i, {i, 1, 3}]
> x = 5;
> If[x == b && xc[[10]] == 4, Print["True"], Print
["False"],
> Print["Can't decide"]]
> 
Hallo Nasser,

you could nest two If[] expressions like this:

If[x==b,
    	If[xc[[10]]==4,
    	    	Print["True"],
    	    	Print["False"],
    	    	Print"Can't decide"]],
    	Print["False"],
    	Print["Can't decide"]]

Regards
Oli


-- 
Regards

Oliver Friedrich

My email has no x!


  • Prev by Date: Re: Re: Result changing
  • Next by Date: Re: Re: Problems eps-export Corel Draw Import
  • Previous by thread: Re: How to tell Mathematica to stop conditional testing in an If statment if one condition is niether True or False? McCarthy evaluation rules? 'and then' test?
  • Next by thread: Re: How to tell Mathematica to stop conditional testing in an If statment if one condition is niether True or False? McCarthy evaluation rules? 'and then' test?