What is a good conceptual way to look at Ruby blocks?
if I have an Array, A, and I pass it to the following function:
def MergeSort(&var)
...
end
And then run the function, passing an Array into it:
MergeSort(A)
Will the array A be treated like a block in the function? What is the benefit of blocks, and what are good patterns to use them in? I realize these are kind of unrelated and potentially random questions; any answer that clarifies Ruby blocks would be appreciated.
Understanding Ruby Blocks, Procs and Lambdas by Robert Sosinski explains it very thoroughly.