I'm having an undefined method +
error when I typed this function with if/else statement in Ruby. Any ideas? I'm sure it's pretty stupid on my part.
def residentfee( resident )
if (resident == 0)
fee += (46 * 2)
else
fee += (50 + 2)
end
end
print "Enter a number: "
number = gets.chomp.to_i
puts residentfee( number )
What am I doing wrong? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire