jwcolby
jwcolby at colbyconsulting.com
Wed Jun 24 14:24:02 CDT 2009
And for that matter, what is an Exit Do? It is a GoTo the line after the loop. It may not be called that but that is exactly what it is. John W. Colby www.ColbyConsulting.com Drew Wutka wrote: > Why? > > Code is used to make a functional project. It's primary purpose is to > do just that. After that, the code should be organized and readable, > and as optimized as possible. With proper objects and function, this > can be accomplished. With the exception of errorhandling a goto > statement is going to be a rare case, but NOT an excluded case, to make > the code readable and organized. In my example, making a do loop would > require addition logic on each step, because when you exit a loop, it > starts all over. > > A Do Loop cannot have extra 'loop' statements. > > Ie: > > Do > > 'some condition is met: then Loop > > Loop > > Can't do that. You can do that with a Goto statement. > > Drew > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte > Foust > Sent: Wednesday, June 24, 2009 11:52 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Learning .Net -- PHP Instead? > > A Do...Loop would be preferable to Goto. > > Charlotte > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka > Sent: Wednesday, June 24, 2009 8:27 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Learning .Net -- PHP Instead? > > I think it should be said that you shouldn't use GOTO to prevent > breaking your code into more logical parts. Errorhandling is a > situation which would allow Goto then. There is another situation. > Let's use an imaginary 'Phone' object that is going to make a call, and > it needs to try 20 times unless successful: > > Dim obj as Phone > Dim intTries as Long > Dim blFailed as Boolean > intTries=0 > Set obj=New Phone > > StartOfCall: > > blFailed=True > intTries=intTries+1 > If intTries=21 then Goto > > The information contained in this transmission is intended only for the person or entity > to which it is addressed and may contain II-VI Proprietary and/or II-VI Business > Sensitive material. If you are not the intended recipient, please contact the sender > immediately and destroy the material in its entirety, whether electronic or hard copy. > You are notified that any review, retransmission, copying, disclosure, dissemination, > or other use of, or taking of any action in reliance upon this information by persons > or entities other than the intended recipient is prohibited. > >