Skip to content

Commit f7ee696

Browse files
authored
Remove incorrect information about foreach-loops (exercism#2003)
1 parent ca27687 commit f7ee696

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

concepts/foreach-loops/about.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,3 @@ Generally a `for-each` loop is preferrable over a `for` loop for the following r
4343
- A `for-each` loop is more _declarative_ meaning the code is communicating _what_ it is doing, instead of _how_ it is doing it.
4444
- A `for-each` loop is foolproof, whereas with `for` loops it is easy to have an off-by-one error (think of using `<` versus `<=`).
4545
- A `for-each` loop works on all collection types, including those that do not support using an index to access elements (eg. a `Set`).
46-
47-
To guarantee that a `for-each` loop will iterate over _all_ values, the compiler will not allow updating of a collection within a `for-each` loop.
48-
For example:
49-
50-
```java
51-
char[] vowels = ['a', 'e', 'i', 'o', 'u'];
52-
53-
for(char vowel: vowels) {
54-
vowels = ['Y']; // This would result in a compiler error
55-
}
56-
```

concepts/foreach-loops/introduction.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,3 @@ Generally a `for-each` loop is preferrable over a `for` loop for the following r
4343
- A `for-each` loop is more _declarative_ meaning the code is communicating _what_ it is doing, instead of _how_ it is doing it.
4444
- A `for-each` loop is foolproof, whereas with `for` loops it is easy to have an off-by-one error (think of using `<` versus `<=`).
4545
- A `for-each` loop works on all collection types, including those that do not support using an index to access elements (eg. a `Set`).
46-
47-
To guarantee that a `for-each` loop will iterate over _all_ values, the compiler will not allow updating of a collection within a `for-each` loop.
48-
For example:
49-
50-
```java
51-
char[] vowels = ['a', 'e', 'i', 'o', 'u'];
52-
53-
for(char vowel: vowels) {
54-
vowels = ['Y']; // This would result in a compiler error
55-
}
56-
```

0 commit comments

Comments
 (0)