Skip to content

Commit 3e8f390

Browse files
authored
Merge pull request #694 from animeshsrivastava24/patch-18
Fix: Typo correction and Unexpected output in for loop document
2 parents 0907e9a + 227ecc2 commit 3e8f390

File tree

1 file changed

+2
-2
lines changed
  • Language/Structure/Control Structure

1 file changed

+2
-2
lines changed

Language/Structure/Control Structure/for.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for (initialization; condition; increment) {
3535
=== Parameters
3636
`initialization`: happens first and exactly once. +
3737
`condition`: each time through the loop, `condition` is tested; if it's `link:../../../variables/constants/constants[true]`, the statement block, and the *increment* is executed, then the *condition* is tested again. When the *condition* becomes `link:../../../variables/constants/constants[false]`, the loop ends. +
38-
`increment`: executed each time through the loop when `contition` is link:../../../variables/constants/constants[`true`].
38+
`increment`: executed each time through the loop when `condition` is link:../../../variables/constants/constants[`true`].
3939

4040
--
4141
// OVERVIEW SECTION ENDS
@@ -69,7 +69,7 @@ void loop() {
6969

7070
[float]
7171
=== Notes and Warnings
72-
The C++ `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid C++ statements with unrelated variables, and use any C++ datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems.
72+
The pass:[C++] `for` loop is much more flexible than `for` loops found in some other computer languages, including BASIC. Any or all of the three header elements may be omitted, although the semicolons are required. Also the statements for initialization, condition, and increment can be any valid pass:[C++] statements with unrelated variables, and use any pass:[C++] datatypes including floats. These types of unusual `for` statements may provide solutions to some rare programming problems.
7373
[%hardbreaks]
7474

7575
For example, using a multiplication in the increment line will generate a logarithmic progression:

0 commit comments

Comments
 (0)