From: Learning Ruby Date: 2006-11-03T22:09:49+09:00 Subject: Output not clear ------=_Part_20953_11734751.1162559382805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I am a newbie to Ruby and the output of the following program is not clear to me. The program is: class Accounts attr_accessor :balance def initialize(name, phone, op_balance) @name = name @phone = phone @balance = op_balance end def deposit(amt) @balance += amt puts @balance.to_s end end class Savings 500.00) balance = @bal - amt puts balance.to_s else puts 'No Balance' end end end s = Savings.new('Pete',65241884,5000.00) s.deposit(500.00) s.withdraw(200.00) puts s.balance.to_s The output I get is: >ruby accounts.rb 5500.0 5300.0 5500.0 >Exit code: 0 I thought that the last line puts s.balance.to_s would have displayed 5300.0. Why is this 5500.0 ? All help appreciated. ------=_Part_20953_11734751.1162559382805--