Hi All,

Thought I'd share this one! If you have a number of function calls that can fail by returning a value and you need to check but also save the result, here's a neat trick:


repeat forever
put empty into myErrorMessage
if somefunction(Inputparam1, Inputparam2,myResult1,myErrorMessage) = false then exit repeat if somefunction(Inputparam3, Inputparam4,myResult2,myErrorMessage) = false then exit repeat if somefunction(Inputparam5, Inputparam6,myResult3,myErrorMessage) = false then exit repeat if somefunction(Inputparam7, Inputparam8,myResult4,myErrorMessage) = false then exit repeat if somefunction(Inputparam9, Inputparam10,myResult5,myErrorMessage) = false then exit repeat
exit repeat
end repeat

if myErrorMessage = empty then

-- Do Success code and work on the results obtained

else

-- Do Failure Code

end if


In this case the "end repeat" acts as a "label" and we simulate a goto with "exit repeat"

Cool, Huh?

All the Best
Dave



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to