Olu
Olu

Reputation: 3526

Return callback() vs callback()

Is there a difference between callback() and return callback() in coffeescript. I've gotten different answers from different people. If there is a block of code after just a callback, the callback function gets called but does the rest of the script continues to run or just it does stops there?

if something
  callback null, 'yes'
else
  callback null, 'no'

// DOES THIS RUN?
if something else
  callback null, 'yes'

Upvotes: 0

Views: 774

Answers (1)

thejh
thejh

Reputation: 45568

Normally, the rest continues to run, but with a return, you can prevent that.

Upvotes: 2

Related Questions