From: Alex Twisleton-Wykeham-F. <al...@fi...> - 2006-03-06 16:00:42
|
On Mon 6 March 2006 15:55, Holger King wrote: > Hi Group, > > is it possible to realize a webmacro recursion within a webmacro > template like: > > #macro counter($counterParam) { > CounterParam: $counterParam<br/> > > #set $digit = $counterParam + 1 > > > #if($digit < 10) > $digit < 10! > #counter($digit) > #end > #else > $digit >= 10 > #end > } > > #counter(1) > > I always get an StackOverflowError when calling the above template. If > the are alternatives using other webmacro directives implementing a > recursion logic, tell me further details. Thanx in advance. #templet $counter { #set $digit = $digit + 1 #if ($digit < 10) { [$digit < 10] #eval $Self using { "digit": $digit } } #else { [$digi >= 10] } } #eval $counter using { "digit": $digit } gives me:- [1 < 10] [2 < 10] [3 < 10] [4 < 10] [5 < 10] [6 < 10] [7 < 10] [8 < 10] [9 < 10] [10 >= 10] Alex |