MathGroup Archive 2010

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

Search the Archive

Re: if with two conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108774] Re: if with two conditions
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Wed, 31 Mar 2010 05:26:17 -0500 (EST)
  • References: <hosi59$o49$1@smc.vnet.net>

"nt" <sagittarius5962 at gmail.com> wrote in message 
news:hosi59$o49$1 at smc.vnet.net...
> Hi all,
>
> Is there a way to build an if statement with two conditions such as:
> if[a>b and a>0,...]. If there is, could you let me know the syntax?
>
> Thanks
> nt
>


a = 3;
b = 2;
If[a > b && a > 0, Print["correct"], Print["try again"]]

or

a = 3;
b = 2;
If[And[a > b, a > 0], Print["correct"], Print["try again"]]

?If

--Nasser 




  • Prev by Date: Re: if with two conditions
  • Next by Date: Re: Beta testers wanted for RootSearch package
  • Previous by thread: Re: if with two conditions
  • Next by thread: Re: if with two conditions