mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Merge pull request #957 from eliaskosunen/master
Add braces to for loop in P.1 example
This commit is contained in:
commit
18e8e91745
|
@ -486,11 +486,12 @@ The second version leaves the reader guessing and opens more possibilities for u
|
||||||
cin >> val;
|
cin >> val;
|
||||||
// ...
|
// ...
|
||||||
int index = -1; // bad
|
int index = -1; // bad
|
||||||
for (int i = 0; i < v.size(); ++i)
|
for (int i = 0; i < v.size(); ++i) {
|
||||||
if (v[i] == val) {
|
if (v[i] == val) {
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user