|
-
May 25th, 2010, 08:55 PM
#1
Thread Starter
New Member
Loops need some help
Hi everyone
I'm slowly learning about loops.
I have a couple of questions
1) When a condition is being tested.. what does that mean? I don't understand the "condition" word.
2) What is the difference between a loop that never ends and a loop that ends?
I have the code for the loop that ends and the loop that never ends. I can see the difference in the code, but I don't understand what is making it different. Here is the code below.
Dim intCount = 0
Do While intCount <= 1
MsgBox("This loop ends")
intCount += 1
Loop
Dim intCount = 0
Do While intCount <= 1
MsgBox("This loop never ends")
Loop
Thanks heaps.
-
May 25th, 2010, 09:07 PM
#2
Re: Loops need some help
1. A "condition" is an expression that evaluates to a Boolean value, i.e. either True or False. That would include any comparison, e.g. (x = 0) or (myDate > Date.Today).
2. An infinite loop is one that itself includes no condition for ending. For example, this is an infinite loop:It's quite rare that you would actually want an infinite loop, but not unheard of. Sometimes the loop itself won't contain a condition for stopping but the body of the loop will, e.g.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|