The code example for foreach does not work #40755
Labels
doc-bug
Problem with the content; needs to be fixed [org][type][category]
dotnet-csharp/svc
lang-reference/subsvc
okr-health
Content-health KR: Concerns article defects/freshness or build warnings.
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Type of issue
Code doesn't work
Description
[Enter feedback here]
The Code example of foreach statement with list of fibonaci numbers does not work.
The list need to be initialized differently :
Instead of:
List<int> fibNumbers = [0, 1, 1, 2, 3, 5, 8, 13];
It should be:
List<int> fibNumbers = new List<int> {0, 1, 1, 2, 3, 5, 8, 13};
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/iteration-statements#code-try-6
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/statements/iteration-statements.md
Document Version Independent Id
8b6cb66c-8bef-fed0-1677-acee6bd3e052
Article author
@BillWagner
Metadata
Associated WorkItem - 252999
The text was updated successfully, but these errors were encountered: