0
How are procs similar to methods?
2 Respostas
+ 4
If I had to draw any lines, I'd say procs are basically delegates. A neat little way to assign methods to a variable, making it easy to pass to another method. I suggest using procs only for simple actions that require no parameters and return no value, and using lambdas instead in those cases, as they are able to return without issue, just like a normal method, and warn you if you're not giving it the expected parameters.
+ 3
Procs are objects which return themselves unlike blocks which are a part of the methods' call syntax.Procs also do not mean anything on thier own and can only appear in argumets.