dotnet / dotnet/csharpstandard

12.16.6.3 Highlight the difference between a for loop and a foreach loop

Open
#120 2 comments 0 reactions 0 assignees View on GitHub
type: clarity
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

We've already mentioned this elsewhere in the spec, but as 13.16.6.3 explicitly notes that an iteration variable declared by a `for` loop is effectively declared outside the loop, I think it would be worth reiterating here that a foreach iteration variable is different, with an example.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.