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: [mg101003] Re: Text and multiple calculations in an IF condition
  • From: Francesco <b.gatessucks at gmail.com>
  • Date: Sat, 20 Jun 2009 04:01:25 -0400 (EDT)
  • References: <h1en44$i4q$1@smc.vnet.net>

f[x_, y_] :=
  If[x > y, Print["a"]; z = x + y, Print[b]; z = x - y]

-Francesco

On 06/19/2009 01:45 AM, Pascal Schulthess wrote:
> 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
>


  • Prev by Date: Re: expression form
  • Next by Date: Re: TeX output via TeXForm: variable name translation
  • Previous by thread: Re: Text and multiple calculations in an IF condition
  • Next by thread: SphericalHarmonics strange behavior