Complex IF Statements in Visual Logic

The complex logic on a single line feature allows you to use complex IF statements without having to write lines and lines of nested statements.

In the Checked Edit Mode there are a number of steps to go through to set up your logic:

1) Right-click in the Visual Logic window and select an IF statement. Add your first variable to the IF statement window and enter = 1 as the inequality and value then click OK to close the IF statement.

2) Reopen the IF statement by pressing ALT and double-clicking. Check the option “Complex Logic on Single Line”. The format of the window will change to have a single line, and “Is True” will be ticked.

3) Add the full line of complex logic and click OK. Ensure you use square brackets around each statement. Use the | key for OR and & for AND. Make sure there are no spaces around the | or &.

In the Free Edit Mode, the logic can simply be typed as in the example below, with square brackets around each statement and ”=1” at the right hand side. It makes no difference if spaces are included around the brackets, variable names or operators - as long as the statement makes logical sense the spacing of the syntax will be adjusted once you enter the statement (bu pressing ENTER).

For example, a line of complex visual logic might look like this:

  IF [var_BM_breakrestart = 1] | [Simulation Time > 100] = 1

Related Commands