Introduction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In the previous lesson, you created a function to find the square root of 289. What if you want to find the square root of 729? Or 576? Perhaps you’ll write another function.

As the numbers change, writing more and more functions isn’t reasonable.

In this lesson, you’ll learn about function parameters and update the findSquareRoot() function to find the square root of different numbers, not just 289. You’ll learn the difference between named and default parameters. Finally, you’ll learn how to return the value calculated by the findSquareRoot() function.

And you’ll keep your Kotlin code clean and concise by reusing the functions you create.

See forum comments
Download course materials from Github
Previous: Quiz: Create Functions Next: Instruction