Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit ab4bcfe

Browse files
Update no-one-iteration-loop.md ("let", not "int") (#368)
Use "let" not "int" to declare the iteration variable
1 parent 0081ef7 commit ab4bcfe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/rules/no-one-iteration-loop.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ At worst that was not the initial intention of the author and so the body of the
77
## Noncompliant Code Example
88

99
```javascript
10-
for (int i = 0; i < 10; i++) { // noncompliant, loop only executes once
10+
for (let i = 0; i < 10; i++) { // noncompliant, loop only executes once
1111
console.log("i is " + i);
1212
break;
1313
}
1414
...
15-
for (int i = 0; i < 10; i++) { // noncompliant, loop only executes once
15+
for (let i = 0; i < 10; i++) { // noncompliant, loop only executes once
1616
if (i == x) {
1717
break;
1818
} else {
@@ -25,15 +25,15 @@ for (int i = 0; i < 10; i++) { // noncompliant, loop only executes once
2525
## Compliant Solution
2626

2727
```javascript
28-
for (int i = 0; i < 10; i++) {
28+
for (let i = 0; i < 10; i++) {
2929
console.log("i is " + i);
3030
}
3131
...
32-
for (int i = 0; i < 10; i++) {
32+
for (let i = 0; i < 10; i++) {
3333
if (i == x) {
3434
break;
3535
} else {
3636
console.log("i is " + i);
3737
}
3838
}
39-
```
39+
```

0 commit comments

Comments
 (0)