From: Joz Private Date: 2012-10-09T05:13:20+09:00 Subject: Undefined method `-' for nil Hi guys. So I've hit a brick wall with a simple piece of code and hope someone here can shed some light on what's going wrong ... *************************************************** developer_object_array.each do |dev| if dev.is_solvent? == false then puts("#{dev.name} is bankrupt.") dev.bankrupt = true bank_object_array.each do |bank| bank.moves_loans(amount) else puts("#{dev.name} is not bankrupt.") end end ********************************************************* I have the above piece of code in a class. Inside this class I create and array of Bank and Developer objects. When the code gets to bank.move_loans I get an "undefined method `-' for nil:NilClass (NoMethodError" error. The move_loans method is defined in the Bank class just does some basic subtraction on the value passed to it. I've no idea what the error is, as I've torn through every piece of code in the classes and can't see anything wrong. Any ideas would be great!! Thanks! -- Posted via http://www.ruby-forum.com/.