4 ms·
I love the idea of changing the syntax around for loops, I just wonder if there was a cleaner way to do all of it, like optional parameters I think it would be
by mikewarot 4y ago
I love the idea of changing the syntax around for loops, I just wonder if there was a cleaner way to do all of it, like optional parameters
I think it would be hard to avoid a lisp-like {{{ hell though
- 0xcoffee 4y agoSeems like the same thing could be achieved cleanly with chainable results. My quick & dirty c# example. For.Loop(10, (i, @break) => { Console.WriteLine(i); @break(); }) .OnComplete((i) => Console.WriteLine("Done")) .OnBreak((i) => Console.WriteLine("Break"));
- levodelellis 4y agoA friend suggested this to me! I felt having `.` on a loop would be weird because it isn't working on an object A few people said they want single statements on conditionals. If `=>` (or `::` as someone else suggested) forced the statement to be on the same line would you be fine? I can imagine people wanting to use it on it's own line like people use else without braces which leads to bugs