Sfairadora

  • Reference Guide

Union

An instance of the union of types is a value of one of the types composing a union. If, for example, a union is composed of an integer (Int) and a string (String), an instance of the union may be either an integer or a string.
A union may be either bound or unbound. A bound union is determined by a list of types representing permitted values of the union instance. Instances of an unbound union may acquire values of any type. The number of enumerated types of a bound union is limited to 254 in the current version.
Using union as the element type in a sequence or array effectively releases the requirement for elements to be of the same type.

Notation

Union(TYPE1, TYPE2, ... TYPEn)
or
TYPE1|TYPE2|...TYPEn
where TYPE1, TYPE2, ... TYPEn are types composing the union (i.e. permitted instance types).