Programming-Idioms

History of Idiom 54 > diff from v20 to v21

Edit summary for version 21 :
New Lua implementation by user [Nepta]

Version 20

2016-04-05, 04:28:04

Version 21

2016-04-07, 07:03:57

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Code
s = 0
for i,v in ipairs(x) do
   s = s + v
end
Demo URL
http://codepad.org/1F3y1nTV