conditional statement syntax

Post Reply
User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

conditional statement syntax

Post 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

User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

conditional statement syntax

Post by Thunderstone »




<IF $var eq "a" or $var eq "b"> is the correct syntax.

-Kai


User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

conditional statement syntax

Post 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".



Post Reply