Is there any way to not return something using CoffeeScript?

前端 未结 5 1071
刺人心
刺人心 2020-11-27 13:03

It seems like CoffeeScript automatically returns the last item in a scope. Can I avoid this functionality?

5条回答
  •  星月不相逢
    2020-11-27 13:09

    It seems functions in CoffeeScript must always return something, even null. In C, you have void as a return type. ->, the empty function, compiles to (function() {}), so it's the only function that doesn't return anything.

提交回复
热议问题