I completely missed that, too. Could we not just put the code below WHEN into an ELSE statement like this?
PROGRAM _CYCLIC
CASE stepTest OF
step1:
var1 := 1;//
IF expression1 THEN
stepTest := step2;
ELSE
var1 := 2; // this is only executed if expression1 is FALSE
END_IF
step2:
IF expression1 THEN
stepTest := step1;
END_IF
END_CASE
expression1 := FALSE;
END_PROGRAM
If you have only one condition per step, then that is no problem. However, I sometimes have more in my code. And then you end up having constructs like
PROGRAM _CYCLIC
CASE stepTest OF
step1:
var1 := 1;//
IF expression1 THEN
stepTest := step2;
ELSE
var1 := 2; // this is only executed if expression1 is FALSE
IF expression2 THEN
stepTest := step3;
ELSE
var1 := 3;
IF expression3 THEN
stepTest := step 4;
END_IF;
END_IF;
END_IF
step2:
...
just for my understanding, to avoid such constructs as above couldn’t we use the ELSIF statement fo ST?
PROGRAM _CYCLIC
CASE stepTest OF
1:
var1 := 1;//
IF expression1 THEN
stepTest := 2;
ELSIF expression2 THEN
var1 := 2; // this is only executed if expression1 is FALSE
stepTest := 3;
ELSIF expression3 THEN
var1 := 3; // this is only executed if expression1 AND expression2 is FALSE
stepTest := 4;
END_IF
2:
...