|
Jacknam Newbie
Joined: 15 Feb 2002 Posts: 8 Location: USA
|
Posted: Fri Feb 15, 2002 2:19 pm
IF Statements |
I seem to be having a problem using the OR expression in my IF statements...Example...
#IF (@var1 = Value1 OR Value2 OR Value 3)
{DoThis}
{DoThat}
In this case no Matter what I get the True form of the IF statement, Even if the Variable is far from equaling either of the 3 Values. Is it something in my syntax thats causing this? The only way I've seen around this is to make Individual IF statements, which sometimes can include alot of typing...Another thing i Tried that didnt work was...
@Var2 = Val1|Val2|Val3
#IF (Var1 = Var2)
{DoThis}
{DoThat}
This didn't seem to work either trying to compare a single word variable to a string variable...Again is it my syntax?
Thanks for any help I can get. |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Fri Feb 15, 2002 4:27 pm |
As far as i can see, its syntax problems....
#IF (@var1=Value1 OR @var1=Value2 OR @var1=Value 3){DoThis}{DoThat}
and
#IF {@Var1 = @Var2}{DoThis}{DoThat}
Try making the changes in bold, that will probably help... |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 15, 2002 5:19 pm |
#IF (@var1 = Value1 OR Value2 OR Value3) is
(@var1 = Value1) OR
(Value2) OR
(Value3)
Therefore, if either Value2 OR Value3 is anything other than false, no, off, or zero then the expression is true. If you want to compare them all to @var1 then each comparison must be stated directly, the way dacheeba did, but it's best to leave a space between the ending brace and the next beginning brace: } { instead of }{.
To determine if a value is in a string list use the %ismember function
#IF (%ismember(@var1,@var2))
LightBulb
All scripts untested unless otherwise noted |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|