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 trialBrian Fallon
4,733 PointsNeed help with the final objective in the Ruby Blocks course
I need assistance with the final objective in ruby blocks. It says using the call method, change the header in the print header file.
Is there supposed to be a call method present in here? I did not see or hear any mention of a built in call method throughout the course thus far so I am a bit confused with what it is asking. The code should be attached.
def print_header(&block)
puts "-- Header --"
puts "-- End of Header --"
end
Andrew Stelmach
12,583 PointsWhy not post up your own solution? Would help other students!
1 Answer
Brian Fallon
4,733 Pointsdef print_header(&block)
puts "-- Header --"
block.call
puts "-- End of Header --"
end
I had forgotten about the block.call method, simple mistake.
MOD: Moved to answer to be marked as Best Answer to close it.
Brian Fallon
4,733 PointsBrian Fallon
4,733 PointsNever mind, this can be closed. I just remembered the block.call method.