Can someone more versed in ruby than I please answer why the following returns nothing?
class ThreeAndFive
def initialize(low_number, high_number)
@total = 0
(low_number..high_number).each do |number|
if (number % 3 == 0 && number % 5 == 0)
@total += number
end
end
#puts @total here returns value of 33165
return @total
end
end
test = ThreeAndFive.new(1,1000)
#This returns nothing but "#<ThreeAndFive:0x25d71f8>"
puts test
shouldn't the result of puts test be the same as if i had called puts on @total directly in the class?