mercredi 24 octobre 2018

how to do a simple test in ruby

I have some code below that gives square numbers. I also wrote a simple test that prints true or false. I was wondering if anyone could help to see why it doesnt work as it currently puts false, when i would be expecting true. Thanks

numbers = (1..20)
test=numbers.each do |number|
 puts number * number
end

puts test == [1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400]

Aucun commentaire:

Enregistrer un commentaire