Comparing Strings - Is My Logic Incorrect? - RESOLVED
by Randy Lutcavich · in Torque Game Builder · 06/09/2009 (12:12 am) · 2 replies
Say you have:
%testString = "test";
if(%testString == "wrong")
{
echo("This should never be seen");
echo(%testString);
}
For some reason when I use this kind of logic in my script, the echo calls will always occur. Why would it even enter the if statement if the condition statement doesn't evaluate to true??
Is this a really stupid question? Am I that tired? Or is there something I should know about torquescript?
%testString = "test";
if(%testString == "wrong")
{
echo("This should never be seen");
echo(%testString);
}
For some reason when I use this kind of logic in my script, the echo calls will always occur. Why would it even enter the if statement if the condition statement doesn't evaluate to true??
Is this a really stupid question? Am I that tired? Or is there something I should know about torquescript?
About the author
Recent Threads
#2
Thanks Aun!
06/09/2009 (1:07 am)
Wow! Glad it was something simple that I was doing wrong. That was driving me crazy! hahaThanks Aun!
Torque 3D Owner Aun Taraseina
if(%testString $= "wrong") { echo("This should never be seen"); echo(%testString); }"==" are used to compare numbers :D