Comment on Real quick question about the "break"
olsonexi@lemmy.wtf 11 months agoidk, maybe C# just doesn’t have great syntax for the way you’re doing it or something, but I think the simplest solution is the most readable in this case:
for (int i = 1; i < JUST_THE_WORST_NUMBER; i += 2) { Console.WriteLine(i); }
m_r_butts@kbin.social 11 months ago
I came up with a contrived example for the sake of illustration, and deliberately chose to use LINQ to build the enumerable because of how valuable it can be in filtering and ordering data. Where and TakeWhile alone can replace a whole lot of continues and breaks.
Your code does the same job as my first example, and it's simpler, and maybe that's more appropriate for the class.