Questions tagged [while-loop]
Use for questions about a segment of code that repeatedly, at the start of each loop, checks some condition and exits if it is false.
5 questions
14
votes
1
answer
3k
views
What is the rationale behind the WebAssembly `if` statements behaving like `block` when it comes to breaking (`br`), rather than being transparent?
So, WebAssembly has two types of blocks of code, block and loop. When you break with br or <...
18
votes
7
answers
5k
views
How can the language or tooling notify the user of infinite loops?
I'm trying to teach a friend to code in Python. I've noticed that whenever they write a while loop with an integer increment, such as the one shown below:
...
10
votes
1
answer
699
views
Parsing `do`-`while`, `while`-`do`-`end` and `do`-`end`
Consider the Lua programming language, which has the following constructs involving the keywords do and end:
...
3
votes
5
answers
335
views
What are the advantages of providing an until loop construct?
An until loop construct until (x) can almost always be achieved with a while loop while (!x). What's a possible reasoning behind ...
22
votes
7
answers
2k
views
What are the pros and cons of having do ... while loops?
One somewhat rarely used, but still occasionally handy, feature of many programming languages is do ... while loops:
...