Skip to content

Instantly share code, notes, and snippets.

@Radagaisus
Created December 10, 2012 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Radagaisus/4248739 to your computer and use it in GitHub Desktop.
Save Radagaisus/4248739 to your computer and use it in GitHub Desktop.
Implicit for loops return values
sum = ->
sum = 0
for i in [1..5]
sum += i
sum = function() {
var i, _i, _results;
sum = 0;
_results = [];
for (i = _i = 1; _i <= 5; i = ++_i) {
_results.push(sum += i);
}
return _results;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment