MathGroup Archive 2010

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

Search the Archive

Re: newbe question about Sting Comparison

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107053] Re: newbe question about Sting Comparison
  • From: "Biff. Bartolemew" <harrytuttle777 at mac.com>
  • Date: Mon, 1 Feb 2010 06:14:56 -0500 (EST)
  • References: <hk3nsk$alp$1@smc.vnet.net>

Thanks Everybody!   That did the trick.  Now I understand the difference 
between Strings and expressions a little bit better


-Regards
-Biff

Biff. Bartolemew wrote:
> Hello,
> 
> I hope someone can help me out, and not laugh to hard at my stupidity, 
> but, I am trying write a little program
> 
> 
> playAGame[] := Module[
>      {car},
>      ans = Input["Would you like to play a game"];
>      Print[ans];
>      If[ans == "yes", Print["you answered yes"],
>          Print["you did not answer yes"]
>      ];
>      If[5 == 5, Print["You suck"], Print["You Rock"]];
> 
>      ]
> 
> The first If statement does not seem to be evaluated.
> 
> Yet, if I type:
>    "yes"=="yes",   I get the answer I am looking for.
> 
> It seems like the string comparison is acting different in the middle of 
> the If statement.  Can someone tell me what I am doing wrong?
> 
> 
> -Thanks
> 


  • Prev by Date: Re: looping
  • Next by Date: Re: How to combine graphics pimitives and Plot function?
  • Previous by thread: Re: looping
  • Next by thread: Re: newbe question about Sting Comparison