Skip to content

Fix: Typo correction and Unexpected output in for loop document #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Language/Structure/Control Structure/for.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for (initialization; condition; increment) {
=== Parameters
`initialization`: happens first and exactly once. +
`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. +
`increment`: executed each time through the loop when `contition` is link:../../../variables/constants/constants[`true`].
`increment`: executed each time through the loop when `condition` is link:../../../variables/constants/constants[`true`].

--
// OVERVIEW SECTION ENDS
Expand Down Expand Up @@ -69,7 +69,7 @@ void loop() {

[float]
=== Notes and Warnings
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.
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.
[%hardbreaks]

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