If you want to understand your code later, use this: Suppose A = 5, I used n instead of A
n = 5 n.times {|x| unless x == 0; n = n * x; ++x; end} pn
To move it forward, you must:
A = [1,2,3,4,5] arb = A.first a = A.count a.times {|x| arb = arb * A[x]; ++x} p arb
Mohammad
source share