Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: ReplaceAll in If Statement

  • To: mathgroup at
  • Subject: [mg19506] Re: ReplaceAll in If Statement
  • From: "David Bailey" <dave-bailey at>
  • Date: Sat, 28 Aug 1999 15:53:24 -0400
  • References: <7q20sl$>
  • Sender: owner-wri-mathgroup at

Tom Compton wrote in message <7q20sl$q9i at>...
>In the following sequence I expected z to evaluate to 1 in the
>Module.  It appears that the test in the module does not
>evaluate to either True or False.  I don't understand why.
>Can anyone explain?
>If[a /. {opts}, z=1, z=2, z=3];
>{a, z} /. {opts}]

To see what had happened I ran test[opList]//TracePrint. If you do this you
will see that you were in effect calling

However your code is set up to work with

As a result you end up testing If[{True}, ..... which is indeed neither true
nor false!

David Bailey
Salford Software

  • Prev by Date: Sqrt problems
  • Next by Date: Re: how long is a long evaluation?
  • Previous by thread: Re: ReplaceAll in If Statement
  • Next by thread: Re: ReplaceAll in If Statement