A function is a group of statements that perform a specific task.
Functions are mostly used to automate the repeated task. They are basically used to divide the large program into smaller chunks.
Divide our program into smaller chunks makes it more organized and manageable. Also, it avoids repetition and makes our code reusable.
The bad thing about function is they are famous with several names. Different programming languages name them differently. For example functions, methods, subroutines, procedures, etc. When you hear any one of them just imagine about the same concept.
There are basically two types of functions in programming.
- Built-in functions
- User-defined functions
Built-in functions — Built-in functions are functions that is comes with language and they are ready to use. For example in kotlin
sqrt()are built-in functions. In kotlin, there is a kotlin standard library, in which all built-in functions are stored. You can check it for more information.
User-defined functions — User-defined functions are functions that are created by programmers according to their needs. You can also create functions according to your needs and that functions will be called user-defined functions.
for more details about user define a function in Kotlin, please visit this.
That’s it for functions guys. Feel free to share with me if I miss something I will love to learn it from you. Please visit my next article for little bit details about the user-defined the function.
Remember no teacher, no book, no video tutorial, or no blog can teach you everything. As one said Learning is Journey and Journey never ends. Just collect some data from here and there, read it, learn it, practice it, and try to apply it. Don’t feel hesitate that you can’t do that or you don’t know this concept or that concept. Remember every programmer was passed from the path on which you are walking right now. Remember Every Master was once a Beginner. Work hard and Give your best.
Till Then Keep Loving, Keep Coding. And just like always I’ll surely catch you up in the next article.
Jai Hind, Vande Mataram 🇮🇳
Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊