mirror of
https://bitbucket.org/Mattrixwv/luaclasses.git
synced 2025-12-06 18:33:59 -05:00
Fixed but where getProd would return 1
when the ary was empty
This commit is contained in:
@@ -233,6 +233,9 @@ function getSum(ary)
|
||||
end
|
||||
|
||||
function getProd(ary)
|
||||
if((ary == nil) or (#ary == 0)) then
|
||||
return 0;
|
||||
end
|
||||
local prod = 1; --Holds the product of all elements. Start at 1 because num*1 = num
|
||||
--Look through every element in the array and add the number to the running product
|
||||
for location = 1, #ary do
|
||||
|
||||
Reference in New Issue
Block a user