3 Mar 2007 00:51
Re: for ... else
Rick Delaney <rick <at> bort.ca>
2007-03-02 23:51:46 GMT
2007-03-02 23:51:46 GMT
On Mar 02 2007, Luke Palmer wrote:
> Or I wonder if there's really a problem here that we're
> addressing, or whether we're just adding syntax because we can.
This syntax awkwardness comes up a lot in various kinds of reports.
for <at> records {
.print;
}
if <at> records {
say "Search returned no records";
}
I've always found it annoying that I have to write <at> records (or
whatever) twice. I don't know if Thomas's idea is the best possible but
it's not horrible. Hmm, I wonder if I could get it into Template
toolkit.
[% FOREACH records %]
<span>[% whatever %]</span>
[% ELSE %]
<span>Search returned no records.</span>
[% END %]
--
--
Rick Delaney
rick <at> bort.ca
RSS Feed