where array must be defined by using an ARRAY statement, type is a keyword that determines the type of the constraint, and offset is an integer.
The FOREACH statement iteratively applies a constraint over an array of variables. The type of the constraint is determined by type. Currently, the only valid type keyword is DIFF. The optional offset parameter is an integer and is interpreted in the context of the constraint type. The default value of offset is zero.
The FOREACH statement that corresponds to the DIFF keyword iteratively applies the following constraint to each pair of variables in the array:
For example, the constraint that all ’s are pairwise distinct for an array A is expressed as
foreach (A, diff, -1);