Hacker News new | past | comments | ask | show | jobs | submit login

The use case for an IIFE (if you do not use its return value) is the same as for a block. It just gives you a new lexical scope and you run the code inside it. In Lua or C, you can do this with a block.

If you use the return value of an IIFE, it ends up being more like a block in an expression-oriented language like Scala or Julia.

In general, closures are like closures, but IIFEs just use a closure to do something that every other language does without one.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: