If you check the scope, it will be a range, so it is a variable with a valid range. For example
for(int x = 0; x < 10; x++){
}
With this for statement for{ }
int x is only valid in this for statement.
for(int x = 0; x < 10; x++){
}
x = 3;
Will result in an error.
int x = 0
for(; x < 10; x++){
}
x = 3;
If you write it outside for {} like this, you can use it even if you exit for.
for(; x < 10; x++){
}
The for statement has been omitted, but I think it will be summarized someday.
Recommended Posts