You can already with the EXIT command.

code:

EXIT
Type
Command


Action Exits the current KiXtart script, or, if used at the topmost level, exits KiXtart.


Syntax EXIT [code]


Parameters code
Optional numeric that defines the error level or exit code to be returned to the calling object.
This is accessed as @ERROR in KiXtart or %errorlevel% in a batch file.


in a UDF:

code:

break on
cls


; using cj's version of the Exponential function, get 23 squared
;and return with an error level of 100
exp2(23, 2) ? ; returns 529
@error ? ; returns 100


Function exp2($base, $power)
$Exp2=1
for $i=1 to $power
$Exp2=$Exp2*$base
next
exit 100 ; set @error to 100 and exit this function
EndFunction


cj

------------------
cj's scripts page
cj's User Guide - 14 May 2001

chrismat@ozemail.com.au


 


[This message has been edited by cj (edited 15 May 2001).]