Search code examples
ceylon

Where would noop be used in Ceylon


I am playing around with this beautiful language and saw a function called noop.

As the documentation says it's a void function that does nothing!!

So why would I use a function that does nothing? Is it for adding "Nop" in assembly (for pipeline etc) but then this would be too low-level wouldn't it?


Solution

  • noop() can take the place of any void (or Anything returning) function. So it's useful to use as a value if you are calling a function or creating an object that requires you to pass in an event handler or callback function, but you aren't interested in responding to the event.