AlmoAtAcclaim has it!
If we branch out of a loop with 'goto' then we hav'nt really left the loop at all. The thing to do is exit each loop (if nested) with `exit` and then exit the function with 'return'
Function Funky(StartFrom,FinishAt,Exclude)
;Loop from start to finish
;Exit if loop range includes exclusion value and return exclusion value
For xloop=StartFrom to FinishAt
IF xloop=Exclude then Exit
Next
If Not XLoop>FinishAt then
Return XLoop
End if
Return
End Function
If we branch out of a loop with 'goto' then we hav'nt really left the loop at all. The thing to do is exit each loop (if nested) with `exit` and then exit the function with 'return'
Function Funky(StartFrom,FinishAt,Exclude)
;Loop from start to finish
;Exit if loop range includes exclusion value and return exclusion value
For xloop=StartFrom to FinishAt
IF xloop=Exclude then Exit
Next
If Not XLoop>FinishAt then
Return XLoop
End if
Return
End Function