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 10:05:10 GMT
On 8/5/02 5:00 PM, "Greg Frohn" <gfrohn@reliacast.com> wrote:

> I've been using velocity for a while now, and for the most part I love
> it.  I'm wondering why are there no for/while loops for VTL?
> 
> The foreach loop can be a bit limiting...especially since VTL doesn't
> seem to support break or continue.
> 
> I'd love for our web developers to be able to do simple things like
> print out the first n elements in a List.  I understand that this can be
> done using range operators and get methods, but having
> while/for/break/continue seems to be much cleaner for many tasks.
> 
> Just wondering what your thoughts/reasons are for not including them.
> 

The problem we are trying to avoid is runaway loops :

  #while(true)
    ...
  #end

Or

  #for( $I= 0; $I < 10; $I = $I -1 )
   ...
  #end

With a foreach, it's awfully hard to make simple mistakes that lead to these
kinds of problems.

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