I did run it, and with two projects which I just uploaded to this 
group. Please explain why I am getting two different values.
Jodi
--- In [EMAIL PROTECTED], "Unicorn.PC.Support" 
<[EMAIL PROTECTED]> wrote:
> Jodi
> 
>     1 TO 5...........   Step is default of 1.
>         The critical Item here is To 5....  not to 6  or to 96.   
To 5....
> 
>         Execution stops at 5.....  Perhaps if you tried running the
> following code ion the immediate window you would understand
> 
>        for times = 0 to 5 step 1:debug.print times: next times
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Jodi Silver" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, May 23, 2004 8:03 PM
> Subject: Re: [vbhelp] Newbie needing help in loops
> 
> 
> > I still do not understand what the final value of the IntB would 
be if it
> is 1 to 5 and a step 1.
> > Would The final value be 5 or is it one higher (6). That was the 
question.
> >
> > 1.Does it end up one or more higher when ending the loop, or is 
the final
> count equal to the 5 if the step is 1.
> >
> > 2. Is 1 to 5 the same as 1 to 5 step 1
> >
> > Jodi
> >
> >
> > Matt Lorenz Jr <[EMAIL PROTECTED]> wrote:
> > A for / next loop is just short hand for a do loop.
> >
> > for times = 0 to 10 step 2
> >     msgbox times
> > next times
> >
> > would give you message boxes saying 0, 2, 4, 6...
> >
> > times = 0
> > do until times > 10
> >   msgbox times
> >   times = times + 2
> > loop
> >
> > would give you a message boxes saying 0, 2, 4, 6 ...
> >
> >
> > I think something you are noticing is WHERE in the for next loop 
the logic
> > is being checked.
> >
> > With a do loop you can have:
> >
> > do until such and such
> > loop
> >
> > or
> >
> > do
> > loop until such and such
> >
> > I do see your point - your counter always ends up 1 or more higher
> > (depending on your step) after it falls out of the loop.
> >
> > This is okay - you almost never really care what the value is 
when falling
> > out of a for / next loop.  This is because you usually have some
> > predetermined number you using.  For example, you know there are 
100 times
> > in a list box and you want to process them you would do
> > For Times = 1 to 100
> >   'processing statements
> > Next times
> >
> > More likely you would do this:
> >
> > For times = 0 to lstItems.listcount - 1
> >   'processing statements
> > Next times
> >
> > So you see - you don't care that your times counter gets one past 
when you
> > fall out.
> >
> > In general, if you are counting things up to discover the number 
that is
> > there you use a do loop, not a for next loop.  Example, how many 
entries
> are
> > in a file on the hard drive called logentries.txt
> >
> > open "c:\logentries.txt" for input as #1
> > ctr = 0
> > do until eof(1) = true
> >     line input #1, linefromfile
> >     ctr = ctr + 1
> > loop
> > close #1
> > msgbox "There are " & ctr & " lines in the file."
> >
> > You can see, you could never properly process a file with unknown 
amounts
> of
> > data with a for / next loop.
> >
> > I hope this gives you a little clarity.
> >
> >
> >
> >
> > ----- Original Message ----- 
> > From: "jodidee2004" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, May 22, 2004 7:50 PM
> > Subject: [vbhelp] Newbie needing help in loops
> >
> >
> > > Hello,
> > > I am a newbie and I need some help understanding some basic 
concepts.
> > >
> > > If I had a loop structure that read:
> > > For IntNumber=1 to 10
> > > and I also had
> > > For IntNumber 1 to 10 step 1
> > > are these identical loop statements?
> > >
> > > Suppose I had a for next loop like this:
> > > for intB=1 to 7 Step 1
> > > Print IntB
> > > Next IntB
> > >
> > > What would the value of IntB be when the loop stops? I think it 
would
> > > be 7 is that correct? Or is it 7 plus 1 to get 8.
> > > ---------------------------------------------------------------
> > > I understand that the step counts by those numbers.
> > > So if I had
> > > for IntCount = 4 to 10 step 2
> > > Print IntCount
> > > next Intcount
> > >
> > > the value of the numeric variable would be 12 when the loop 
stops.
> > >
> > > 4,8,10,12   and it would stop at 12 since this is higher than 
10.
> > >
> > > Can someone explain this to me a bit better, I am confused by 
all
> > > this. Does it increase at the end the amount of steps past the 
end
> > > value?
> > >
> > > Jodi
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > '// =======================================================
> > >     Rules : http://ReliableAnswers.com/List/Rules.asp
> > >     Home  : http://groups.yahoo.com/group/vbHelp/
> > >     =======================================================
> > >     Post  : [EMAIL PROTECTED]
> > >     Join  : [EMAIL PROTECTED]
> > >     Leave : [EMAIL PROTECTED]
> > > '// =======================================================
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> > '// =======================================================
> >     Rules : http://ReliableAnswers.com/List/Rules.asp
> >     Home  : http://groups.yahoo.com/group/vbHelp/
> >     =======================================================
> >     Post  : [EMAIL PROTECTED]
> >     Join  : [EMAIL PROTECTED]
> >     Leave : [EMAIL PROTECTED]
> > '// =======================================================
> >
> >
> >
> > Yahoo! Groups SponsorADVERTISEMENT
> >
> >
> > ---------------------------------
> > Yahoo! Groups Links
> >
> >    To visit your group on the web, go to:
> > http://groups.yahoo.com/group/vbhelp/
> >
> >    To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> >
> >    Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> >
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Domains - Claim yours for only $14.70/year
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> >
> > '// =======================================================
> >     Rules : http://ReliableAnswers.com/List/Rules.asp
> >     Home  : http://groups.yahoo.com/group/vbHelp/
> >     =======================================================
> >     Post  : [EMAIL PROTECTED]
> >     Join  : [EMAIL PROTECTED]
> >     Leave : [EMAIL PROTECTED]
> > '// =======================================================
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >





'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to