[ create a new paste ] login | about

Link: http://codepad.org/1F3y1nTV    [ raw code | output | fork ]

nepta - Lua, pasted on Apr 7:
1
2
3
4
5
6
7
8
9
function sum(x)
   local s = 0
   for i,v in ipairs(x) do
      s = s + v
   end
   return s
end

print(sum {1,2,3})


Output:
1
6


Create a new paste based on this one


Comments: