How to do Compound Conditionals?
I have a variable which can take on any of 50 values. For two of those values I want to do a certain step. For all the rest I want to do a different step. So, what I want is:
If ($Var = A) OR ($Var = B)
Command set 1.
Else
Command set 2.
Command set 2 cannot be executed UNLESS $Var <> A AND $Var <> B,
so I can't just run Command set 2, and then put Command set 1 into 2 clones with the simple conditions $Var = A, $Var = B.
If I can't do the compound conditionals, I'm thinking I have to put this into 50 steps:
If $Var = A
Command Set 1.
If $Var = B
Command Set 1.
If $Var = C
Command Set 2.
.
.
.
What's the best way to do this?
Thanks,
John Bobinyec
If ($Var = A) OR ($Var = B)
Command set 1.
Else
Command set 2.
Command set 2 cannot be executed UNLESS $Var <> A AND $Var <> B,
so I can't just run Command set 2, and then put Command set 1 into 2 clones with the simple conditions $Var = A, $Var = B.
If I can't do the compound conditionals, I'm thinking I have to put this into 50 steps:
If $Var = A
Command Set 1.
If $Var = B
Command Set 1.
If $Var = C
Command Set 2.
.
.
.
What's the best way to do this?
Thanks,
John Bobinyec
2 answers
I have a variable which can take on any of 50 values. For two of those values I want to do a certain step. For all the rest I want to do a different step. So, what I want is:
If ($Var = A) OR ($Var = B)
Command set 1.
Else
Command set 2.
Command set 2 cannot be executed UNLESS $Var <> A AND $Var <> B,
so I can't just run Command set 2, and then put Command set 1 into 2 clones with the simple conditions $Var = A, $Var = B.
If I can't do the compound conditionals, I'm thinking I have to put this into 50 steps:
If $Var = A
Command Set 1.
If $Var = B
Command Set 1.
If $Var = C
Command Set 2.
.
.
.
What's the best way to do this?
Thanks,
John Bobinyec
Hi,
I think you're looking for this enhancement. Feel free to add comments or your scenario. In my projects, I have used your 50 step pattern. In my case, I haven't had that many options so it wasn't as much of an issue.
Brent Ulbricht
RTC Build Lead
I've had a similar issue, and been able to reduce it to 3 ifs by using an additional variable telling me if I've met the condition already
if Var$A
.tset env "condition_found='Y'
command set 1
if Var$B
.tset env "condition_found='Y'
command set 1
if $condition_found !='Y'
command set 2
Hope this helps.
if Var$A
.tset env "condition_found='Y'
command set 1
if Var$B
.tset env "condition_found='Y'
command set 1
if $condition_found !='Y'
command set 2
Hope this helps.