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
This content was released on May 22 2024. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.