with-return ( quot -- )
Factor handbook » The language » Continuations

Prev:attempt-all ( ... seq quot: ( ... elt -- ... obj ) -- ... obj )
Next:Continuation implementation details


Vocabulary
continuations

Inputs
quota quotation with stack effect ( obj -- obj' )


Outputs
None

Word description
Reifies a continuation from the point immediately after which this word would return and allows calling the return in quot to easily resume the continuation and continue execution. If return is not called and quot returns, then execution continues (as if this word were simply call).

Examples
Only "Hi" will print:
USING: prettyprint continuations io ; [ "Hi" print return "Bye" print ] with-return
Hi


See also
return

Definition