For a long while now, we’ve allowed you to set local variables in your templates and emails with the set() function. Like so:

{set(‘myvar’, 42)}

Well, set() is fine but it was a little limited, and kind of ugly-looking. One of our clients emailed today and asked how they could loop through an array of items and conditionally multiply the weight of some items based on user preferences.

So we added a real assignment operator. You can now do the prettier-looking:

{myvar = 42}

And, more importantly, you can now use full accessor syntax just the way you’d expect:

{myheadlines[0].title = “First Headline”}

It’s always cool to see what clients are doing with our syntax, so let us know, especially if you feel like you’re missing anything!