happy-rusty
    Preparing search index...

    Function Break

    • Creates a Break variant of ControlFlow.

      Use this to signal that an operation should exit early with the given value.

      Type Parameters

      • B

        The type of the break value.

      • C = never

        The type of the continue value (defaults to void when a value is provided).

      Parameters

      • value: B

        The value to return on break.

      Returns ControlFlow<B, C>

      A ControlFlow in the Break state.

      const flow = Break('found it');
      console.log(flow.isBreak()); // true
      console.log(flow.breakValue().unwrap()); // 'found it'

      const voidFlow = Break();
      console.log(voidFlow.isBreak()); // true
    • Creates a Break variant of ControlFlow with no value. This overload is used when the operation exits early but doesn't produce a meaningful value.

      Type Parameters

      • C = never

        The type of the continue value (allows type specification when chaining with Continue).

      Returns ControlFlow<void, C>

      A ControlFlow<void, C> in the Break state.

      const voidFlow = Break();
      console.log(voidFlow.isBreak()); // true
      console.log(voidFlow.breakValue()); // Some(undefined)

      // With explicit type parameter
      const typedFlow = Break<number>(); // ControlFlow<void, number>