OCLOperators whentrue

When you have an immutable OCLexpression, you always return a value - and then the OCLOperators_caseTrueFalse is good - but when using the MDriven Action-Language that allows updates of objects, another construct is introduced to compact things even more:


The return is always the arg0


let x=SomeObject.SomeEnum in (  

Fun fact: "whentrue" and logical "and" are implemented the same - the logical "and" only evaluates arg1 of arg0 is true (lazy evaluation) and "whentrue" does the same thing, but always returns arg0.

This means that a convoluted but equivalent construct can be:

let x=SomeObject.SomeEnum in (  
  (x=#Enum1) and (SomeObject.DoYourThing1;true);  
  (x=#Enum2) and (SomeObject.DoYourThing2;true);  
  (x=#Enum3) and (SomeObject.DoYourThing3;true) 
This page was edited 5 days ago on 06/17/2024. What links here