ForceUnwrap
public protocol ForceUnwrapRaw protocol backing the postfix ! (force-unwrap) operator.
Implemented by Optional[T] (with Output = T): value! yields the
contained value, or aborts the process via fatalError when the value is
.None. Use ! only where the absence of a value is genuinely a
programming error — prefer if let, ??, or try when .None is a
recoverable case.
Examples
let port: Int64? = .Some(8080);
let p = port! // 8080
let missing: Int64? = .None;
missing! // PANICAssociated Types
type Output
type OutputMethods
consuming func forceUnwrap() -> Output
consuming func forceUnwrap() -> OutputReturns the contained value, or traps if it is absent.
Defined in lang/std/core/force_unwrap.ks