From: Joz Private Date: 2012-10-09T06:22:16+09:00 Subject: Re: Undefined method `-' for nil Sam Duncan wrote in post #1079016: > On 10/09/2012 09:35 AM, Joz Private wrote: >> then true >> >> end >> amount_of_deposits, amount_of_loans >> else >> class Bankrupter >> MN = Developer.new("MN", 3000000, "100000, 300000", "BOI,RSB", false) >> bank_object_array = [ AIB, Anglo, BOI, RBS, Ulster ] >> end >> else puts("#{dev.name} is not bankrupt.") >> end >> end >> >> end >> > Well for a start, Bank#moves_loans method takes an 'amount' argument > which you don't appear to be passing. I wouldn't be assigning your bank > and developer instances to constants either (variable names starting > with upper case letters are implicitly constants in Ruby). Also, the > constructor for the Bank object takes 3 values, however you are passing > them 5? > My bad, I just copied the code wrong .... assuming I have all that fixed ... I've stumbled on this: The move_loans method works if I use this code below as I get the output: def move_loans puts(amount_of_loans - amount) end But if I replace the body with what I really want, it throws the error: def moves_loans amount_of_loans = amount_of_loans - amount end It seems to be THAT body right there that's throwing the error...what's going on??!! > Sam -- Posted via http://www.ruby-forum.com/.