Forum

Difference between Exit and Return

Rakhesh Sasidharan
25 January 2011, 07:34

Hiawatha version: 7.4
Operating System: Lenny

Hi,

This is probably a silly question coz I haven't seen anyone else ask it.

What's the difference between Exit and Return?

From the man page, I understand that "RequestURI isfile Return" will stop toolkit processing if the file exists - leading me to believe that "Return" means exit processing. But if that's the case why does the RequestURI command also have "Exit" as an action?

Similarly, for the Rewrite command, the man page says "Rewrite will terminate toolkit processing, unless Continue or Return has been given." - which sort of contradicts with my understanding that "Return" means exit processing, coz if that were the case then why have it as an option for the Rewrite command since it will exit processing anyway?

Thanks,
Rakhesh

p.s. This is a nice forum in that there's no need to register and create an account etc. Enter the name & captcha and easily start posting. Good idea!
Hugo Leisink
25 January 2011, 09:09
The difference between Return and Exit is that Return only exits the current routine and exit exits from all routines. Look at the following example:
UrlToolkit {
ToolkitID = start
Call sub
}

UrlToolkit {
ToolkitID = sub
Match .* Return
}

If you start at rule 'start', the routine 'sub' is called. It will return on any URL (because of the .* match). Because of the Return, it will go back to the start routine. If the Return in sub is replaced with 'Exit', it will not return to start, but simply stop. Hope this clears things up.
Rakhesh Sasidharan
25 January 2011, 10:56
Yes it does. Thanks.
This topic has been closed.