Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Foundations Methods Class Methods

"Wrong number of arguments (2 for 0)"

When I attempt to pass my code to the interpreter I get "wrong number of arguments (2 for 0)". My code follows:

class BankAccount

def self.create_for(first_name,last_name)
    @accounts ||= []
    @accounts << BankAccount.new(first_name,last_name)

def intialize(first_name, last_name)
    @balance = 0
    @first_name = first_name
    @last_name = last_name

def deposit(amount)
    @balance += amount


def withdraw(amount)
    @balance -= amount


BankAccount.create_for("Jason", "Seifer")

I thought I had followed the example in the video but I must be missing something. I would appreciate any help.

2 Answers

John O.
John O.
4,680 Points

Simple typo:

def intialize(first_name, last_name)

Should be:

def initialize(first_name, last_name)

O wow. I appreciate the help.