Documentation Language: Swift

Function

excludes(_:_:)

Tests whether a collection does not contain a specific element.

func excludes(_ collection: any EcoreValue, _ element: any EcoreValue) throws -> Bool

Parameters

collection

The collection to search in

element

The element to search for

Return Value

true if the element is not found, false otherwise

Discussion

The excludes operation is the logical inverse of includes, returning true if the element is not present in the collection.

Examples

let numbers = [1, 2, 3] as [EInt]
let hasNoFour = try excludes(numbers, 4 as EInt)  // Result: true