Is there any way to not return something using CoffeeScript?
问题 It seems like CoffeeScript automatically returns the last item in a scope. Can I avoid this functionality? 回答1: You have to explicitly return nothing, or to leave an expression evaluating to undefined at the bottom of your function: fun = -> doSomething() return Or: fun = -> doSomething() undefined This is what the doc recommends, when using comprehensions: Be careful that you're not accidentally returning the results of the comprehension in these cases, by adding a meaningful return value —