🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators nullValue


A typed null value is used to assign a null value to an attribute or a variable, or to return null from a method.

someobject.someattribute := <Type>.nullValue

Example

Given a Car class, we can create a variable vCar:

vCar:Car

and add a name:

vCar:= Car.Create;
vCar.Name:='Ferari x'

Now we can unset the Name attribute using nullValue like this:

vCar.Name:=String.nullValue

Do not use <Type>.nullValue to compare something to null, like this

vCurrent_UppdragTyp = Uppdragstyp.nullValue    -- WRONG

To compare to null, use the operators .isNull or .notNull