Keyword for program flow, similar to a for loop.
while (/* condition */)
{
//Perform this while condition is true
}
- Prefer a for-statement to a while-statement when there is an obvious loop variable [1]
- Prefer a while-statement to a for-statement when there is no obvious loop variable [2]
- [1] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 9.8. Advice. page 240: '[4] Prefer a for-statement to a while-statement when there is an obvious loop variable'
- [2] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 9.8. Advice. page 240: '[5] Prefer a while-statement to a for-statement when there is no obvious loop variable'