OCLOperators whenfalse
This page was created by Charles on 2024-08-16. Last edited by 62.169.16.147 on 2026-09-12.
The whenfalse OCL operator is the opposite of the whentrue operator. It is used to specify an expression to be run when the Boolean argument expression is false.
It can be used to chain Boolean expressions.
Example[edit source]
let x=SomeObject.SomeEnum in ( (x=#Enum1).whenfalse(SomeObject.DoYourThing1); (x=#Enum2).whenfalse(SomeObject.DoYourThing2); (x=#Enum3).whenfalse(SomeObject.DoYourThing3) )
If this is FALSE, do something.
Example Using whenfalse:
isValid = false
isValid.whenfalse(User.showErrorMessage)
- If
isValidis false show error message - Otherwise do nothing
- Result returned:
isValid(false)
