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

bank_account.rb no method error for '+'

I am working on the Ruby Deep Dive and am having an issue when I try to run the deposit or withdraw functions. I've reinstalled rvm/brew and rewritten the code about a dozen times but when I run

"class BankAccount def initialize(first_name, last_name) @balance = 0 @first_name = first_name @last_name = last_name end

def deposit(amount) @balance += amount end

def withdraw(amount) @balance -= amount end end"

I receive the error: "NoMethodError: undefined method +' for nil:NilClass from /Users/rorymccarron/Source/methods/bank_account.rb:8:indeposit' from (irb):5 from /Users/rorymccarron/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in `<main>'"

any suggestions would be appreciated.

Thanks, R

2 Answers

Okay, never mind, I had to delete the devtools from my system and reinstall everything. it's working fine now.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Glad it's working now, Rory! Let us know if you have any more problems.