Created
December 10, 2012 06:04
-
-
Save Radagaisus/4248739 to your computer and use it in GitHub Desktop.
Implicit for loops return values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sum = -> | |
sum = 0 | |
for i in [1..5] | |
sum += i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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