r/learnruby • u/boris_a • Sep 07 '15
Implicit and explicit blocks - totaly confused!
Hi all, I learn ruby with rubymonk. I need not just an answer but general explanation of the code examples given in Rubimonk and will specify few questions hoping that will not be considered a violation of the rules. What does explicitly pased block mean? Does the second parameter of the method filter is a block? There is no any prefix before the block word - in the first row.
def filter(array, block)
array.select(&block)
end
Why the first block - second parameter is called explicit and the second one (with the prefix) implicite? Generally what mean explicit and implicit? I can not understand these two terms. Please tell me where I can found good explanation about blocks as if I was a child. thanks
View all comments
Show parent comment
1
u/boris_a Sep 07 '15 edited Sep 07 '15
Thanks for the answer! I have to consider it. The method recieve a block as a second parameter. Is it what you wrote in your first code example?
for I am a bit confusing with this
Thanks for the explanation of an explicit and an implicit terms! I think I got it for it sounds simple this way. But I am not sure understand why they (in the example of the site) say that the second one (on the second row) &block is implicit.