Skip to content

Instantly share code, notes, and snippets.

@sirramongabriel
Created September 5, 2013 20:19
Show Gist options
  • Select an option

  • Save sirramongabriel/6455593 to your computer and use it in GitHub Desktop.

Select an option

Save sirramongabriel/6455593 to your computer and use it in GitHub Desktop.
# account.rb
class Account
def initialize(balance)
@balance = balance
end
attr_accessor :amount
attr_reader :balance
def withdraw(amount)
@balance -= amount
puts "You chose to withdraw #{amount} from your account."
puts "Your new balance is #{@balance}"
end
def deposit(amount)
@balance += amount
puts "You chose to deposit #{amount} into your account."
puts "Your new balance is #{@balance}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment