D
Dominic Son
Hi
Learning Ruby.
Is it possible to divide values while inside an iteration?
for example i'd like to do something like this:
h = [40,20,50,200]
h.each do |num,total| num / 24 = total
print "#{total} \n" end
as you'd expect, there is an error because of that '/' and '=' sign in
this iterator.
so since this isn't possible what would be the best way to do what i'm
trying to do? or perhaps my syntax is wrong
thank you very much.
Dominic
Learning Ruby.
Is it possible to divide values while inside an iteration?
for example i'd like to do something like this:
h = [40,20,50,200]
h.each do |num,total| num / 24 = total
print "#{total} \n" end
as you'd expect, there is an error because of that '/' and '=' sign in
this iterator.
so since this isn't possible what would be the best way to do what i'm
trying to do? or perhaps my syntax is wrong
thank you very much.
Dominic