Created
May 4, 2011 19:34
-
-
Save netzpirat/955851 to your computer and use it in GitHub Desktop.
Return nothing from a CoffeeScript function
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
# Everything is an Expression | |
-> | |
greeting = 'Hi CoffeeScripter' | |
# Expect it's undefined | |
-> | |
greeting = 'Hi CoffeeScripter' | |
return undefined |
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
(function() { | |
(function() { | |
var greeting; | |
return greeting = 'Hi CoffeeScripter'; | |
}); | |
(function() { | |
var greeting; | |
greeting = 'Hi CoffeeScripter'; | |
}); | |
}).call(this); |
Is there a global setting/configure to avoid writing "return"? The programmer can control the "return". I mean that return when we write it??
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do the same by just saying "return" (without "undefined").