The code below demonstrates a bug when using GOTO within nested FOR loops inside a UDF. The GOTO takes code executon out of the nested loops. Execution continues until the the ENDFUNCTION statement is hit. Then the code jumps back into the first FOR loop. The second (inside loop) seems to have been killed by the GOTO.

code:
Function C
dim $s, $t, $u, $array1[5]
$s = "Text from Function 'C'"
$array1 = "1","2","3","4","5","6"
for each $t in $array1
for each $u in $array1
? "U = " + $u + " T=" + $t
Goto LabelC
? "After Goto LabelC"
? "U2= " + $u + " T=" + $t
next
next
:LabelC
? $s ?
$C = $s
;exit
Endfunction
? ?
"function C = " + C

_________________________
Home page: http://www.kixhelp.com/hb/