Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPAUL JULIAN
16,038 PointsBLOCK NAME
Just to confirm, the block has to have the same name as the method that's calling it?
4 Answers
Jamie Barton
14,498 PointsPAUL JULIAN From what I can gather yes, otherwise you don't know the method you're sending a block to.
Jamie Barton
14,498 PointsHi PAUL JULIAN
You can pass in anything to the block which is a local variable. So in that video show_numbers do |number| could be |n| or |num|
You can also use names inside of the setter and getter blocks which don't have to be the same.
Is this what you mean?
PAUL JULIAN
16,038 PointsI mean 'show_numbers' do |number| ... has to be the same as the method name 'def show_numbers'
PAUL JULIAN
16,038 PointsThanks