-
thanks guys. i think i really have to redesign the process or use goto. Goto isn't there for nothing, i think microsoft opted not to remove that statement which originated from BASIC since there are times that it is inevitable that we use goto. thanks and more power to all of you.
[Edited by orasbot on 04-11-2000 at 10:19 PM]
-
I agree with HarryW and avoid gotos like the plague and tend only to ue them when error handling and generally use the EXIT statement like this:
Do
statement
statement
If condition then
exit Do
endif
Loop until something
For x = y to z
statement
statement
If condition then
exit FOR
endif
Next
have a look in the help file for more info
DocZaf
{;->
-
DocZaf, I completely agree with you. Never use GoTo statements, the only reason MS left them in there is because of Error handling. If use GoTo then you've basically made your job that much harded the next time you or somebody else has to update your code. In fact, if anyone of the programmers on my team submits code with GoTo statements in it (other than for Error handling) I reject the code immediately. If you ever find yourself needing to resort to using GoTo to control your program flow then you should stop coding immediately, step away from the computer, take a pencil and a piece of paper, sit down and start at the top level of you procedure and re-work your logic flow. There is always a more efficient way to write the code, I guarantee it! Either through procedures or through a different type of logic flow.
Just a coding tip from someone who learned this lesson the hard way.
[Edited by SonGouki on 04-11-2000 at 10:45 PM]