From ea4eaf02b61a137d09db8123c3144e61c8ed8a30 Mon Sep 17 00:00:00 2001 From: ayagrwl <43722027+ayagrwl@users.noreply.github.com> Date: Sun, 17 Mar 2019 22:32:39 +0530 Subject: [PATCH] Added applications and external link (#29227) --- guide/english/cplusplus/for-loop/index.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guide/english/cplusplus/for-loop/index.md b/guide/english/cplusplus/for-loop/index.md index 95ba81c86f..e653bda0cb 100644 --- a/guide/english/cplusplus/for-loop/index.md +++ b/guide/english/cplusplus/for-loop/index.md @@ -152,5 +152,16 @@ Output: 5 ``` +## Applications of the for loops + +### Use as infinite loops + +This C-style for-loop is commonly the source of an infinite loop since the fundamental steps of iteration are completely in the control of the programmer. In fact, when infinite loops are intended, this type of for-loop can be used (with empty expressions), such as: +``` +for (;;) + //loop body +``` + ## Additional Resources - [Range for-loop](https://guide.freecodecamp.org/cplusplus/range-for-loop) +- [More on For Loops](http://www.cplusplus.com/doc/tutorial/control/)