[Templates] Looping through numbers

[prev] [thread] [next] [Date index for 2005/01/03]

From: Buddy Burden
Subject: [Templates] Looping through numbers
Date: 19:49 on 03 Jan 2005
Guys,

Just wanted to check in with the group to make sure I'm not missing an easy 
way to do something.  What I want to do is something like:

[% FOREACH x IN 1..20 %]
:
:
[% END %]

but of course that doesn't actually work.  I finally settled on:

[% FOREACH x IN [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ] %]
:
:
[% END %]

as marginally better than:

[% SET x = 1 ; WHILE x <= 20 %]
:
:
	[% SET x = x + 1 %]
[% END %]

but I'm not particularly happy with it.  Is there a better way that I'm not 
seeing?  TIA.


		-- Buddy

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Looping through numbers
Buddy Burden 19:49 on 03 Jan 2005

Re: [Templates] Looping through numbers
Gavin Estey 19:52 on 03 Jan 2005

Re: [Templates] Looping through numbers
Buddy Burden 20:16 on 03 Jan 2005

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52