# Code block confusion

**URL:** <https://www.ruby-forum.com/t/code-block-confusion/102126>\
**Category:** Ruby\
**Created:** [August 11, 2006, 3:53am UTC](https://www.ruby-forum.com/t/code-block-confusion/102126 "2006-08-11T03:53:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 11, 2006, 3:53am UTC](https://www.ruby-forum.com/t/code-block-confusion/102126/1 "2006-08-11T03:53:51Z")

</div>

I am sifting through the Ruby bible “Pickaxe” and I am not sure how you  
figure out which methods can be passed a code block.

I have seen them used in arrays [1,2,3,4].each{|x|puts x} ; which sort  
of makes sense, but there is another piece in the book that uses the do  
end code block on the scan method? p65 at the top. I looked at the ruby  
docs for this method and I don’t see how you “know” that the code block  
can be used at this point.

Thanks for the help

p.s sorry if I just overlooked it…

---

<div class="post-metadata">

**Author:** ![cjnkns](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@cjnkns](https://www.ruby-forum.com/u/cjnkns)\
**Post date:** [August 11, 2006, 4:14am UTC](https://www.ruby-forum.com/t/code-block-confusion/102126/2 "2006-08-11T04:14:27Z")

</div>

> p.s sorry if I just overlooked it…

sorry I did overlook it.
