Re: ReplaceAll in If Statement
- To: mathgroup at smc.vnet.net
- Subject: [mg19459] Re: [mg19448] ReplaceAll in If Statement
- From: Jean-Marie Thomas <jmt at agat.net>
- Date: Sat, 28 Aug 1999 15:52:57 -0400
- Organization: TeA
- References: <199908250525.BAA24791@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
This happends because
a/.{opts} evaluates to {True} and not to True
Hope this helps,
jmt
On Wed, 25 Aug 1999, Tom Compton wrote:
> 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?
>
> In[1]:=
> opList={a->True};
>
> In[2]:=
> test[opts___]:=Module[{},
> If[a /. {opts}, z=1, z=2, z=3];
> {a, z} /. {opts}]
>
> In[3]:=
> test[opList]
> Out[3]=
> {{True,3}}
>
>
>
> Tom Compton
- References:
- ReplaceAll in If Statement
- From: "Tom Compton" <comptont@concentric.net>
- ReplaceAll in If Statement