Forum Discussion

dp_119903's avatar
dp_119903
Icon for Cirrostratus rankCirrostratus
Aug 05, 2015

Can you take multiple actions on an if statement?

I'm fairly familiar with if / elseif statements. I know how to make multiple conditions in an "if" statement, but I'm having issues taking multiple actions on an if statement. The irule is not complaining of syntax, but it doesn't seem to work.

 

I just need to know if it's possible to say:

 

if {condition} { DO THIS AND DO THIS

 

I've tried doing it multiple ways. I've tried putting an "and" between the two actions, but that didn't work. I've tried listing the actions one line after the other, but it seems that only the first action is taken.

 

I'm sure this is a pretty simple thing to do but I haven't come across the documentation for it just yet so any assistance would be appreciated.

 

1 Reply

  • Hi!

    The question is a bit fuzzy, but I'll try to answer and see if it meets your expectations. 🙂 All you need to do is to separate the commands by a new line, or a semicolon.

    if { condition } {
        command 1
        command 2
    }
    
    if { condition } { command 1; command 2; }
    

    Does that answer your question?

    /Patrik