Skip to content

Instantly share code, notes, and snippets.

@slloyd
Created February 14, 2014 21:58
Show Gist options
  • Save slloyd/9010247 to your computer and use it in GitHub Desktop.
Save slloyd/9010247 to your computer and use it in GitHub Desktop.
How to write a function that might not return anything
foo = (a, b, plusOne = true) ->
out = a + b
out += 1 if plusOne
var foo;
foo = function(a, b, plusOne) {
var out;
if (plusOne == null) {
plusOne = true;
}
out = a + b;
if (plusOne) {
return out += 1;
}
};
@leoromanovsky
Copy link

lol, yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment