On Tue, Oct 20, 2009 at 18:52, Jim Spath <[email protected]> wrote:
> The following does not produce any output:
>
> foo = 0;
> FOREACH value IN foo;
>   value;
> END;
>
> According to the docs, I'd expect it to output 0.

You need to force foo to be evaluated as a list:

foo = 0;
FOREACH value IN foo.list;
  value;
END;

Adding .list to something that's already a list is a no-op:

foo = [ 0 ];
FOREACH value IN foo.list;
  value;
END;

This is why .grep works, btw; calling grep on a scalar promotes it to a list.

-- 
(darren)

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to