ColdFusion 8.0.1 adds pizazz to implicit array/struct creation

This post is more than 2 years old.

One of my favorite features in ColdFusion 8 is the ability to create and populate structs and arrays in one line of code:

<cfset a = ["paris","britney","lindsey"]> <cfset s = {name="Raymond",age="Almost 35",weight="204"}>

This is so darn useful I can't imagine life without it.

ColdFusion 8.0.1 makes this even better by letting you nest these implicit creations:

<cfset s = {name="Raymond",age="Almost 35",weight="204",kids=["Jacob","Lynn","Noah"]}> <cfdump var="#s#">

Which results in:

Now obviously you don't want to go crazy with this. You still want to keep things readable!

(Sorry for all the blog entries. I can't sleep and I figured I'd share some of my favorite parts of 8.0.1.)

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA