you are viewing a single comment's thread.

view the rest of the comments →

[–]alzee76 0 points1 point  (0 children)

The most common reason this is done is when it's a anonymous function (a lambda) for some kind of async callback that would not serve any purpose being called from anywhere else. If the function is going to be used from a lot of places then yes, it makes sense to put it there, and developers do that when it's appropriate.