So I recently saw an example of a recursive Function, and now I'm trying to understand it. I've written this:
DEF SUM(A[]) IF(LEN(A))THEN RETURN(SUM(A)+POP(A)) ENDThe function returns a Type mismatch error, and I'm not quite understanding why. My current reasoning is that the function is (somehow) returning an array which I inevitably am trying to assign to a variable, but I don't see why that is. This is how the function appears in my head:
DEF SUM(A[]) IF(LEN(A))THEN RETURN(POP(A)+POP(A)+POP(A). . .+POP(A)) ENDThe function calls iterations of itself LEN(A) times and sequentially sums up each iteration with the previous, returning the end result. Why is this a type mismatch?