Page 1 of 1
conditional statement syntax
Posted: Fri Jun 16, 2000 4:12 pm
by Thunderstone
I've been having trouble with the syntax of a particular conditional statement. Here's the situation:
I have a variable, $var, that has several values: "a" "b" "c" "d". I want to be able to do something like the following:
<$var = "a" "b" "c" "d">
<loop $var>
<if $var eq "a" or "b">
command set 1...
<else>
command set 2...
</if>
</loop>
The problem is, I can't seem to get the syntax on that "if" statement quite right, as the commands in "command set 1" never execute.
Can someone tell me how to properly write this conditional statement?
Thanks.
Todd
conditional statement syntax
Posted: Fri Jun 16, 2000 4:38 pm
by Thunderstone
<IF $var eq "a" or $var eq "b"> is the correct syntax.
-Kai
conditional statement syntax
Posted: Fri Jun 16, 2000 5:01 pm
by Thunderstone
want to be able to do something like the following:
quite right, as the commands in "command set 1" never execute.
Right now, I have my statement set up as:
<if $var eq "a"> , and this seems to execute properly (because <$var =
"a">.
However, if I expand it so that it reads:
<if $var eq "a" or $var eq "b"> , it doesn't execute properly, even though
$var equals "a" but not "b".
Perhaps I should have been more explicit in my example. You see, sometimes
<$var = "a" "b" "c" "d">, but sometimes <$var = "a" "c" "d">. In
circumstances where the latter is true, the conditional won't execute, even
though it is an "or" conditional. So, I'm still stuck with a problem. I
still want the conditional to execute if it equals "a" but not "b".