GOLF(2gg)
π GOLF(2gg) β return-handler π
okay bestie, gather round, because this one is so important and it's giving main character energy for real.
β¨ NAME β¨
return-handler β (program-flow) πΈ
π PURPOSE π
Bounce out of the request handler you're currently in and go back to whoever called you. that's it. that's the whole vibe. π¦
β¨ SYNTAX β¨
return-handler [ <return value> ]
π DESCRIPTION π
so return-handler returns from the current request handler by handing control back to its caller. simple! iconic! π
but here's where it gets spicy, because how it returns depends on what kind of request you're handling:
- If the current request handler is handling an external request (like from a web browser, an API, a command line, etc.), then
return-handleris literally equivalent toexit-handler. same thing, no cap. β¨ - If the current request handler was handling an internal request β meaning it got called from another request handler via
call-handlerβ then control transfers back to that handler immediately after thecall-handler. like, right after. no detours. π«Ά
For internal requests, that number <return value> gets passed back to the caller, and the caller can grab it with the "return-value" clause in call-handler. π
- If
<return value>is omitted, it's assumed to be0. default behavior, we love her. π - If the current request handler is handling an external request, then
<return value>will also set the handler's exit status (peepexit-statusandexit-handlerfor the deets). π₯
π EXAMPLES π
In this example, "req-handler" (the caller) will call "other-handler" (the callee), and the callee will return to the caller β immediately after call-handler. here's the caller, slaying:
begin-handler /req-handler public
...
call-handler "/other-handler" return-value rval
...
end-handler
and here's the callee handler, doing her little exit:
begin-handler /other-handler public
...
return-handler 5
...
end-handler
The value of "rval" in the caller will be 5. β¨ that's it, that's the magic. π«
π¦ SEE ALSO π¦
Program flow
break-loop call-handler code-blocks continue-loop do-once exit-handler if-defined if-true quit-process return-handler start-loop β See all documentation π
mwah, that's the whole page bestie π this one came from the $DATE drop, version $VERSION, filed under GOLF(2gg) β go forth and return-handler responsibly, ily πβ¨
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms