Chapter 5.3 : Working with Functions in Kotlin (Android)

In this article, you will learn about functions scope like local and as member functions.

Before moving to current topic, I explained Kotlin from beginning and you can find full list of previous tutorial at Kotlin page.

In previous articles, we have learned about functions. In first article, we learned for return value and default argument in parameters. In second article, we learned about variable argument and infix notation in function.

Local function

Kotlin supports local functions. Local function means a function inside a function. It is also known as nested function.

This kind of functionality is very much helpful when you want to divide your function’s functionality into deeper level.

Member function

In any Object Oriented language, you can create class and its properties. Those properties also include function to perform. Such function known as member function.

Summary

In this article, you learned how to work with local/nested and member functions.

Thanks for reading. Please ask any doubts in the comment. Don’t forget to share this article.

Protected by Copyscape

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone