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 trial

Ruby

darius goore
darius goore
3,803 Points

Ruby Methods Visibility error in calling class method

trying to follow along with the visibility video and getting the following error when I try to call the reset method: 1.9.3-p194 :004 > bank_account.deposit(100) NameError: undefined local variable or method `bank_account' for main:Object from (irb):4

2 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey darius goore did you already create a bank_account object in IRB? Is it possible you misspelled something?

darius goore
darius goore
3,803 Points

it's likely that is what happened. I'll have to go back and check it later thanks. In the meantime, I have another question re: blocks and the yield example. the iterator used is "i". but the argument for the block is "number" I am not sure how these relate, i.e. how does the block know that number should take the value of the iterator i?