a guest May 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- // In this week's episode of "YOUR DOING IT WRONG"
- void Main()
- // The ** OLD ** keyword-heavy way to write a for loop.... nobody does this any more...
- for (int i = 0; i < 12; i++)
- // WHY memorise all that custom syntax, that *only* applies to `for` statements.
- // MUCH better to have general principles that are used everywhere and just use those.
- //The NEW way to write a for loop... uses the proprietary fforr function... no keywords!
- fforr(() => 0, i => i < 12, i => ++i, (i) =>
- public void fforr(Func<int> iCreator, Predicate<int> test, Func<int, int> incrementi, Action<int> doAction)
- var i = iCreator();
- while (test(i))
- i = incrementi(i);
RAW Paste Data