velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis <j...@respublica.fr>
Subject Re: #foreach tool
Date Wed, 11 Sep 2002 16:24:02 GMT
As you wish, Sir!

You will use it like that:

#foreach ($item in $numbers)
         Look mom: $item equals $numbers.more()!
#if ($item == 8)$numbers.break()#end
#end


As for now, you can do something similar but it is less obvious:

#foreach ($item in $numbers)
#if (!$break)
         Look mom: $item equals $numbers.more()!
#if ($item == 8)#set( $break = true )#end
#end
#end

Cheers,
-- Denis.

On Wednesday, September 11, 2002, at 04:45  pm, 
Christoph.Reck@dlr.de wrote:

> Could you add the break functionality requested many times in this 
> list?
>
> Updated example:
>>  *  #set ($list = [1, 2, 3, 5, 8, 13, 'a', 'b', 'c'])
>>  *  #set ($numbers = $mill.wrap($list))
>>  *   *  #foreach ($item in $numbers)
>         Look mom: $item equals $numbers.more()!
>       #if( ($item == 8) && $numbers.break() )#end## this is the 
> desired break condition
>>  *  #end
>>  *
>
> -- :) Christoph Reck
>


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message