From the course: Programming for Non-Programmers: Android & Kotlin

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Methods

Methods

From the course: Programming for Non-Programmers: Android & Kotlin

Start my 1-month free trial

Methods

- [Instructor] Methods are another fundamental building block of programming and are pretty much required in any application that you create. If variables are the nouns of programming, methods are the verbs, or actions, of programming. What I mean by that is methods are groups of code that are put together logically. Maybe you're going to have a method to add numbers together in a calculator application. And there are many different steps to adding the numbers together. So you might have a method called Add Numbers and put all of the related code inside of that method. So in that way, we group it together and it's reusable, meaning we can use it whenever we want. Think of responding to a button press-in code when the user presses a numeric button on the keyboard and all of the things that have to happen after that user presses the button. When you put the code in the method to handle that button press, you can reuse that code every time a button is pressed. In this way, methods can…

Contents