|
|
|
|
|
by paddim8
435 days ago
|
|
The only difference is that you have to specify the type of the list when you declare it though... That's not really a big deal. List<string> names = ["Peter", "Julia", "Xi"];
names.Select(name => $"Hello, {name}").ForEach(greeting => Console.WriteLine($"{greeting}! Enjoy your C#")) or new List<string> { "Peter", "Julia", "Xi" }.Select(name => $"Hello, {name}").ForEach(greeting => Console.WriteLine($"{greeting}! Enjoy your C#")) |
|
To jump in a REPL (or any debug breakpoint observation facility), having optional type inference is a great plus to my mind.
Note that Crystal does allow to make type explicit, and keep the fluent interface on track doing so:
Let’s remark by the way that, like with C# lambda parameters, block parameters are not explicitly typed in that case.