It seems like CoffeeScript automatically returns the last item in a scope. Can I avoid this functionality?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to explicitly return nothing, or to leave an expression evaluating to undefined at the bottom of your function:
Or:
This is what the doc recommends, when using comprehensions:
You could, however, write a wrapper like this:
(Notice the splat operator here (
...))And use it like this when defining functions:
Or like this: