Syntax
anArray.count()
SemanticsCounts the number of elements in anArray. The count operation returns an Integer value. The count of an empty array is zero.
SubstitutablesanArrayCan be any variable or object attribute having the type Array
Examples
set size = anArray.count();

Figure below shows an example of counting the elements of the array myList that is an attribute of class InputContainer. The array elements are of type String. The output is of base type Integer named nrOfElements.

Figure: count() Example

The count() operation can also be used in conditions of decision points:

Figure: Example of Operation count() in a Condition

In the figure above, the flow branches depending on the number of array elements in array myArray. If the array contains at least one element, the flow branches to the action node create message for non-empty myArray.