I'm a bit confused about, how does Return[], returns result from function. For example, take those two functions:
CalcLossTotal = Function[
{data, units},
Clear[i];
Return[Table[
data[[i, 1]]*units,
{i, 1, Length[data]}]
];
];
and
CalcPremiums = Function[
{data, lossTotal},
Clear[i];
Return[Table[
data[[i, 2]]*lossTotal[[i]],
{i, 1, Length[data]}]
];
];
wheres CalcPremiums[] depends upon CalcLossTotal[] and data which is same for both of them. Upon calculating LossTotal (e.g. result from CalcLossTotal[]), result returned from it isn't array of data, but
Return[{0,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000}]
Is this the way Mathematica works, or there is something that i miss when defining/returning from functions.
Thanks in advance.