My initial findings were erroneous.

I think you uncovered a bug. I substituted a valid file and changed the "exit 0" to "exit 4". The function returned "1" but @error was still "0".

There is some relationship with exist() that short circuits the functions ability to properly return an exit code.

But this behavior only seems to occur when the function name assignment involves the return value of exist()

I have even tried
code:
function FileExists($filename)
;dim $FileExists
$FileExist = exist($filename)
$FileExists = $FileExist
if $FileExist
? "exit 0" ?
;$FileExists = 1
exit 4
else
? "exit 2 @@error = @error" ?
;$FileExists = 0
exit 2
endif
endfunction

This fails but if you uncomment the $FileExists within the "IF" it works.

[ 07 May 2002, 07:18: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/