Something that I’ve always loved in Angular is the
ngRepeat directive provides a way to access the
isLast properties of the iteration. It could be cool for ColdFusion to do the same thing:
<!--- .... render contact .... --->
<cfif ! isLastContact>
I don’t need this all the time. But, it’s much nicer than having to store in the
index value and check to see if
(index < contacts.len()).
I think this would work just as nicely for other loop-types (query, struct, list, etc).
I will second this suggestion!
Your loop above could be done with css… thinking of other use case…
or to fancy your lines up add these : Simple Styles for Horizontal Rules | CSS-Tricks - CSS-Tricks
I’ve definitely used CSS and things like
:last-child to alter the way something happens in a list. But, this isn’t always possible (such as when the thing being added needs complex HTML structure). But yeah, I do like using CSS when possible as it reduces the complexity in the code.
I doubt this would be adopted the original code is more readable IMHO, plus cfloop already has a kitchen sink of attributes <cfloop> :: Lucee Documentation
That’s for sure! It’s kind of bananas how much that one little tag does.