|
Tanuki Novice
Joined: 06 Nov 2008 Posts: 38
|
Posted: Tue Jan 18, 2011 12:44 am
Need Help with ForAll loop in Function |
I'm trying to use a Forall loop inside of a Function but the %1 which should reference the current value in the Forall loop seems to reference the parameter instead.
Here is an example Function. If someone could clarify what I am doing wrong I would appreciate it.
This should return 10
but instead returns 01|2|3|41|2|3|41|2|3|41|2|3|4
<func name="TestFunction" type="StringList" id="534">
<value>;#var list {1|2|3|4}
;#show @TestFunction(@list)
ReturnValue = 0
#forall ($para1) {
#MATH ReturnValue @ReturnValue+%1
}
#return @returnValue</value>
<arglist>$para1</arglist>
</func> |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Jan 18, 2011 1:23 am |
%i, not %1 :). And in a nested loop it continues in order to the next letter: %j
|
|
|
|
Tanuki Novice
Joined: 06 Nov 2008 Posts: 38
|
Posted: Tue Jan 18, 2011 1:37 am |
Thank you!
|
|
|
|
Tanuki Novice
Joined: 06 Nov 2008 Posts: 38
|
Posted: Tue Jan 18, 2011 1:37 am |
Thank you!
|
|
|
|
|
|