About 50 results
Open links in new tab
  1. What's the exact distinction between the FOR loop and the WHILE Loop

    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 statement in the …

  2. 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:

  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 content. In this …

  4. python - When Does a While Loop Break - Stack Overflow

    Jan 9, 2013 · A while loop doesn't automatically exit in mid-loop as soon as its condition is no longer true; it just checks the condition at the start of each loop. If you want to get out early, you need to …

  5. when to use while loop rather than for loop - Stack Overflow

    One main difference is while loops are best suited when you do not know ahead of time the number of iterations that you need to do. When you know this before entering the loop you can use for loop.

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

    May 19, 2017 · 1693 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 on a single …

  7. 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.

  8. How do I plot in real-time in a while loop? - Stack Overflow

    I am trying to plot some data from a camera in real time using OpenCV. However, the real-time plotting (using matplotlib) doesn't seem to be working. I've isolated the problem into this simple exa...

  9. While loop with if/else statement in Python - Stack Overflow

    Apr 25, 2016 · What a while-loop says is if True, keep doing till False. If you watch automate the boring stuff- While Loops on YouTube it should give you a understanding of how a while loop can be used …

  10. How to break out of while loop in Python? - Stack Overflow

    Jan 30, 2013 · 8 Don't use while True and break statements. It's bad programming. Imagine you come to debug someone else's code and you see a while True on line 1 and then have to trawl your way …