Re: Iterate before loop end

From: Top Spin (ToppSpin_at_hotmail.com)
Date: 10/22/04


Date: Fri, 22 Oct 2004 00:03:33 -0700

On Thu, 21 Oct 2004 23:08:07 -0700, Bob O`Bob
<filterbob@yahoogroups.com> wrote:

>Top Spin wrote:
>
>> Here's my sample code. I would appreciate some help in what I can do
>> at line 13. I don't want to do the error testing at the top because it
>> changes and I am already doing it in the individual Case statements.
>
>
>Well, *I* would simply use a GoTo.
>
>But if you're unable to bring yourself to do such a thing, there are a few other
>choices, like moving the common processing to a separate procedure, or adding
>another "one-shot" block structure to permit coding an exit, such as in this
>example:
>
>
> Do
> For i = 1 to 1
> sAns = UserInput()
> Select Case UCase$(sAns)
> Case "abc"
> ...do some processing
> Case "def"
> ...do some processing
> Case "xyz"
> ...do some processing
> Case Else
> ...do some error processing
> Exit For
> End Select
> ...do some common processing
> Next
> Loop

Yep, that's pretty much what I came up with.

I did some coding in an IBM language called Rexx. It had several very
useful features such as the Iterate statement that would allow me to
restart any loop from anywhere inside that loop. For loops with
counters, I could also restart any of the outer loops as well. That
saved a lot of code in certain situations.

Thanks

-- 
Running MS VB 6.0 Pro (SP5) on Win2K-SR2
For email, use Usenet-20031220 at spamex.com


Relevant Pages

  • Re: Writing Excel cells within Access
    ... Some sample code that may get you started (you can add loops to this code to ... loop through each worksheet in a book if you'd like). ... EXCEL workbook and reads data from it and writes the data into a recordset. ... "Bob Bonta" wrote in message ...
    (microsoft.public.access.modulesdaovba)
  • Re: Can .FindNext return Nothing??
    ... You're definitely underpaid ... >I think that it won't wraparound to the first cell. ... The sample code is looking ... >Loop While Not c Is Nothing And c.Address FirstAddress ...
    (microsoft.public.excel.programming)
  • Re: Newbie: FOR loop on dates
    ... Sample code: ... Private Sub Form_Load ... Dim d As Date ... I want to loop through all dates between ...
    (microsoft.public.vb.general.discussion)
  • Re: for what are for/while else clauses
    ... > So in some sample code: ... But we expect that from a while loop. ... most Python statements pass control to the next statement ...
    (comp.lang.python)
  • Summary: System crashing in loop
    ... OBP firmware version. ... but will crash and end up in a state ... The only way out of this loop, is to power off the system ... and restart. ...
    (SunManagers)