Anterrio Howard2,625 Points
Help with Bank accounts
Create an initialize method for the BankAccount class that takes one argument, name, which sets @name as an instance variable on initialization.
BankAccount = Class.new BankAccount = Class.new
Jeff MudayTreehouse Moderator 24,835 Points
You might want to re-watch the video explaining Ruby classes. Ruby is a very nicely laid out and logical language. It is worthwhile to learn and Treehouse has some great courses to learn it!
To define a class in Ruby, you use the "class" keyword and make sure to use the "end" keyword to make the closure of the class.
class BankAccount end
The second part of the challenge is asking for you to create a function called "initialize" for BankAccount.
1 The "initialize" needs to accept a parameter called "name".
2 the parameter needs to be assigned to the class variable name (@name)
3 finally, create a new class array called @transactions
class BankAccount def initialize(name) @name = name @transactions = Array.new end end