470,643 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,643 developers. It's quick & easy.

while-loops enter the last time after condition is filled?

it seems to me from my results that when i use a while-loop it will
execute once after the condition is met.

ie the conditions is met the code executes one time more and then
quits.
Apr 5 '08 #1
4 1320
it seems to me from my results that when i use a while-loop it
will execute once after the condition is met.
Nope.
ie the conditions is met the code executes one time more and
then quits.
Must be that your conditional is wrong, or your conditions are
not updated the way you think they are.

-tkc
Apr 6 '08 #2
On Apr 6, 9:53 am, skanem...@yahoo.se wrote:
it seems to me from my results that when i use a while-loop it will
execute once after the condition is met.

ie the conditions is met the code executes one time more and then
quits.
The syntax is this:

while condition:
do_something()

Do you mean that it executes do_something() only once, but you expect
it to execute more that once?

Or should we interpret your seemingly inconsistent statement by
changing "condition(s) is met" to "condition(s) is NOT met" -- in
other words, it is executing one EXTRA time after you expect it to
have stopped?

Perhaps you should supply a short example of runnable code (including
print statements to show what is happening), the actual output that
you got when you ran that code, and what was the output that you
expected.
Apr 6 '08 #3
On Apr 6, 4:53*am, skanem...@yahoo.se wrote:
it seems to me from my results that when i use a while-loop it will
execute once after the condition is met.
Perhaps your condition is wrong. Please provide the code where this
occured.
Apr 7 '08 #4
On 6 avr, 01:53, skanem...@yahoo.se wrote:
it seems to me from my results that when i use a while-loop it will
execute once after the condition is met.

ie the conditions is met the code executes one time more and then
quits.
The problem is obviously in your code, but since you failed to post
the minimal code exhibiting the problem, we can't help.
Apr 7 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Brittany | last post: by
33 posts views Thread by Diez B. Roggisch | last post: by
4 posts views Thread by James E Koehler | last post: by
9 posts views Thread by JS | last post: by
147 posts views Thread by Michael B Allen | last post: by
5 posts views Thread by maestro | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.