====== Simatic S7 SCL reference: Program control operations ====== Back to reference overview: [[de:s7:scl_reference|Simatic S7 SCL reference with examples]] ==== IF: Run conditionally ==== {{anchor:if}} The instruction //"Run conditionally"// branches the program flow depending on a condition. The condition is an expression with Boolean value (TRUE or FALSE). Logical expression or comparative expressions can be stated as conditions. The simplest lineup is when the branch consists of only one query: IF THEN END_IF; {{:de:s7:if_1_example.png|IF (simple)}} For a more complex lineup, a "else" branch is added to the branch: IF THEN ELSE END_IF; {{:de:s7:if_2_example.png|IF (with "else")}} The composite branch, when one or more additional "IF" branches are embedded in the "IF" block, with "ELSE" branches: IF THEN ELSIF THEN ELSE END_IF; {{:de:s7:if_3_example.png|IF (with "elsif")}}