Re: Basic conditional statement question.
- To: mathgroup at smc.vnet.net
- Subject: [mg48688] Re: [mg48653] Basic conditional statement question.
- From: DrBob <drbob at bigfoot.com>
- Date: Thu, 10 Jun 2004 02:44:12 -0400 (EDT)
- References: <200406090817.EAA15671@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Either of these will work for you, I think: If[a == 0, Null, Print["such and such"], Print["such and such"]] "such and such" If[ !TrueQ[a == 0], Print["such and such"]] "such and such" Bobby On Wed, 9 Jun 2004 04:17:30 -0400 (EDT), Scott <jujio77 at yahoo.com> wrote: > Here is a question I would think has a simple solution. Let's say I > have some variable "a" which is an integer, but I haven't defined it > in Mathematica. I want to run a conditional statement on it. > Basically > > If[a!=0,Print["such and such"]] > > When I do something like this, Mathematica I asume is spitting out a > null statement, because it doesn't do anything. So, how can I define > "a" such that Mathematica knows it isn't =0 yet, still some integer. > > The reason I ask is I am calculating Christophel symbols (and such) > and many of them =0, so I want to only output those that are not equal > to zero. > > Thanks for any help, > Scott > > -- DrBob at bigfoot.com www.eclecticdreams.net/index.html
- References:
- Basic conditional statement question.
- From: jujio77@yahoo.com (Scott)
- Basic conditional statement question.