OCLOperators casetruefalse
This page was created by Hans.karlsen@mdriven.net on 2021-12-03. Last edited by Stephanie@mdriven.net on 2025-02-13.

This is a new compact form to write :

if somebool then
  someexpressionwithtypeX
else
  someOtherexpressionwithtypeX
endif

This operator enables you to write the same thing as

somebool.casetruefalse(someexpressionwithtypeX,someOtherexpressionwithtypeX)

This makes a switch like construct look like this:

let x=SomeObject.SomeEnum in
(
  (x=#Enum1).casetruefalse(SomeObject.DoYourThing1,DoNothing);
  (x=#Enum2).casetruefalse(SomeObject.DoYourThing2,DoNothing);
  (x=#Enum3).casetruefalse(SomeObject.DoYourThing3,DoNothing)
)

See also OCLOperators_whentrue