velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@adeptra.com>
Subject Re: question about loops
Date Tue, 06 Aug 2002 15:43:47 GMT
On 8/6/02 11:12 AM, "Nathan Bubna" <nathan@esha.com> wrote:

> Denis said:
> ...
>> If I'd wanted to display 10 first items of a list, I would like to
>> be able to do something like:
>> 
>> 
>> #set ($indexes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
>> #foreach ($index in $indexes)
>> #display( $items[index] )
>> #end
> 
> you can do this easily. just use the short syntax for defining an integer
> array "[x..y]" and call get(int) on your list of items...
> 
> #foreach( $index in [1..10] )
> #display( $items.get($index) )
> #end

Yep

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
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