Results 1 to 3 of 3

Thread: A little problem with loop

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59
    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]

  2. #2
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    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
    {;->

  3. #3
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width