Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Text and multiple calculations in an IF condition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100984] Re: Text and multiple calculations in an IF condition
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Fri, 19 Jun 2009 20:46:08 -0400 (EDT)

Hi everybody,

I have a small problem, and haven't found any solution yet. So I hope you 
can help me.

I'd like to have describing text, comments and multiple calculations when 
one condition is true, and others when it's false.

For example:

If[a>b,
	do something here;
	and something else here;
	insert a text here;
else
	do something;
	and more;
]

As far as I tried this is not possible with the if condition provided?!
But I also think this quite easy to do, if you know how to.

Thanks for your help.

Pascal


Hi, Pascal,
try this:


a = 3; b = 2;
If[a > b, Print["do something here;
   and something else here;
   insert a text here"],
  Print["do something;
   and more"]];

a = 3; b = 4;
If[a > b, Print["do something here;
   and something else here;
   insert a text here"],
  Print["do something;
   and more"]];


do something here;
and something else here;
insert a text here

do something;
and more

Have success, Alexei

-- 
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.




  • Prev by Date: Re: Text and multiple calculations in an IF condition
  • Next by Date: Integrate[], Sort[] and Hold[]
  • Previous by thread: Re: Text and multiple calculations in an IF condition
  • Next by thread: Re: Text and multiple calculations in an IF condition