jashkenas/coffee-script — Issue #1902: Assign contents of an array to a list of variables
Author: Turfel
Created: 2011-11-29 21:46:55+00:00
State: open

I saw this in some other language (I think it was Python?) and found this pretty handy:

For example, if you already know that a certain function is going to return a number of values and you know that they are going to be returned in a certain order, you can write their names on the right side of the "="-sign and the funciton on the left. It helps with readability of the source code:

f = ->
["first", "second", "third"]

first, second, third = f() //first="first, second="second", third="third"