Added some information about variable in 'for' loop (#31440)

This commit is contained in:
dannyphan2910
2019-03-15 02:24:24 -04:00
committed by The Coding Aviator
parent f39bd634a6
commit 3a05e44af7

View File

@ -15,7 +15,7 @@ for (variable initialization; boolean expression; increment expression)
* `initialization` - Initializes the loop and is executed just once, at the beginning.
You can initialize more than one variable of the same type in the first part of the basic `for` loop declaration; each initialization must be separated by a comma.
You can initialize more than one variable of the same type in the first part of the basic `for` loop declaration; each initialization must be separated by a comma. Remember that the variable(s) declared as the `initialization` will only be used within that `for` loop and nowhere else outside of the loop.
* `expression` - Evaluated at the beginning of each iteration. If the `expression` evaluates to `true`, `Statements` will get executed.
* `increment` - Invoked after each iteration through the loop. You can increase/decrease the value of variables here. Be sure the increment is working towards the expression value, to avoid an infinite loop.