velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nat...@esha.com>
Subject Re: question about loops
Date Tue, 06 Aug 2002 15:12:23 GMT
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

Nathan Bubna
nathan@esha.com


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