Ok,

now to start giving some tips
Quite essential for udfs, preventing later headaches, is to dim every single variable used in this udf, except the passed parameters and the return var, speak $NameOfUDF.

Example:

Let's say you have a loop where you increment a counter $i from 1 to 100
and call within any udf using accidentially the same var :

Code:

for $i = 1 to 100
$result = MyUDF($i)
next

.
.
.

function MyUDF($input)
$i = $input - 1 ;'dim $i' would have prevented the endless loop
$MyUDF = $i
endfunction



Result : Endless loop


Edited by Jochen (2004-06-08 09:26 PM)
_________________________