I can agree that the last Exit @ERROR is probably better

However I don't think setting the Function to the Error is good.

As an example let's suppose that you had a function that read a remote value
from the registry and you expected it to be between 1 and 5
Well as you would rewrite it unless one specifically tested for the Error condition first
(I agree that is probably best coding but we all know that we don't all always do that first)

Example:

Dim $T
$T = ReadRegValue('some computer')
'The value was: ' + $T ?



In this example if say 5 came back the admin would think, cool that's the right value and
proceed from there, but in reality it could easily have been 5 - Access Denied

Setting the Function to 0 after ANY error prohibits any misunderstanding like that.
With the way it is now it would come back blank

If one did better coding one would know, but I still don't see the value in setting it to the error.

Dim $T
$T = ReadRegValue('some computer')
If @ERROR
  'ERROR: There was an error accessing the information: ' + @ERROR + ' - ' + @SERROR ?
Else
  'The value was: ' + $T ?
EndIf