-
def sum =0
-
def addToSum = function(x) { sum += x }
-
karate.forEach(array, addToSum)
-
karate.log(‘Sum of array elements:’, sum)
-
print sum
-
Match sum == value
-
I am using this function to add all the values in an array.
When using karate.log the actual value is displayed, while using print 0 is printed when evaluating sum is 0 only, value is not reflected