About 34,800,000 results
Open links in new tab
  1. When to use "while" or "for" in Python - Stack Overflow

    Dec 27, 2022 · When I should use a while loop or a for loop in Python? It looks like people prefer using a for loop (for brevity?). Is there any specific situation which I should use one or the …

  2. What's the exact distinction between the FOR loop and the WHILE …

    Dec 12, 2022 · The major difference between for loop and while loop is that for loop is used when the number of iterations is known, whereas execution is done in a while loop until the …

  3. Difference between "while" loop and "do while" loop

    Sep 2, 2010 · The do while loop executes the content of the loop once before checking the condition of the while. Whereas a while loop will check the condition first before executing the …

  4. python - How to emulate a do-while loop? - Stack Overflow

    1126 I need to emulate a do-while loop in a Python program. Unfortunately, the following straightforward code does not work:

  5. loops - For vs. while in C programming? - Stack Overflow

    There are three loops in C: for, while, and do-while. What's the difference between them? For example, it seems nearly all while statements can be replaced by for statements, right? Then, …

  6. How would I stop a while loop after n amount of time?

    115 how would I stop a while loop after 5 minutes if it does not achieve what I want it to achieve.

  7. Syntax for a single-line while loop in Bash - Stack Overflow

    May 19, 2017 · 1691 while true; do foo; sleep 2; done By the way, if you type it as a multiline (as you are showing) at the command prompt and then call the history with arrow up, you will get it …

  8. loops - Is there a "do ... until" in Python? - Stack Overflow

    Jun 21, 2015 · 337 There is no do-while loop in Python. This is a similar construct, taken from the link above.

  9. Why use a for loop instead of a while loop? [duplicate]

    Oct 7, 2010 · Possible Duplicates: Iterate with for loop or while loop? Loops in C - for() or while() - which is BEST? When should one use a for loop instead of a while loop? I think the following …

  10. c# - 'do...while' vs. 'while' - Stack Overflow

    Jul 28, 2010 · 116 Possible Duplicates: While vs. Do While When should I use do-while instead of while loops? I've been programming for a while now (2 years work + 4.5 years degree + 1 year …