Enumeration

Never

The return type of functions that do not return normally, that is, a type with no values.

Declaration

@frozen enum Never

Overview

Use Never as the return type when declaring a closure, function, or method that unconditionally throws an error, traps, or otherwise does not terminate.

func crashAndBurn() -> Never {
    fatalError("Something very, very bad happened")
}

Topics

Instance Properties

Instance Methods

func hash(into: inout Hasher)

Hashes the essential components of this value by feeding them into the given hasher.

Operator Functions

static func != (Never, Never) -> Bool

Returns a Boolean value indicating whether two values are not equal.

static func ... (Never) -> PartialRangeFrom<Never>

Returns a partial range extending upward from a lower bound.

static func ... (Never) -> PartialRangeThrough<Never>

Returns a partial range up to, and including, its upper bound.

static func ... (Never, Never) -> ClosedRange<Never>

Returns a closed range that contains both of its bounds.

static func ..< (Never) -> PartialRangeUpTo<Never>

Returns a partial range up to, but not including, its upper bound.

static func ..< (Never, Never) -> Range<Never>

Returns a half-open range that contains its lower bound but not its upper bound.

static func < (Never, Never) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.

static func <= (Never, Never) -> Bool

Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.

static func == (Never, Never) -> Bool

Returns a Boolean value indicating whether two values are equal.

static func > (Never, Never) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.

static func >= (Never, Never) -> Bool

Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.

See Also

Exiting a Program

func fatalError(() -> String, file: StaticString, line: UInt) -> Never

Unconditionally prints a given message and stops execution.