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 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.