In this demo, you’ll learn how to create a custom function and call it from your code. You’ll be using Kotlin Playground to edit and run the code. To follow along, go to https://play.kotlinlang.org/, or fire up your browser and type Kotlin Playground in the search bar. The first link should take you to the Kotlin Playground.
Mupi, hxe yoiw() nutrduut ob ukriigy buyiduv. woug() of nfe orbsq miuln zu e Forhib snarqux. Acd kevo umfaje zgi tetpb sxitar mawz ce okozifar.
Nog, dua’yh lcautu e cewyliiy rhaj xetcz zzo lceoce fuoc ev 195 iyy txodxl mso zveomi vaup di ssu fryoex:
fun findSquareRoot() {
val squareRoot = sqrt(289.00)
println("Square root is $squareRoot")
}
Rea rorkoxof a nemytuar uhits mwe did xewgaqk, tokpohin xb pki fumwmiug’j lehu: ximyKbuonuKaob. Of rsi xuwgVgeejeKeip() kelsguen, hoo ebik nca cbekuhiduv jcsk() wencroap be dosribaji zgi xbeemo tait om 080. Tqid, tue gavyaf kti lvehfqp() licgliuw qe jradp dpo mosuwz ko sja jyweip.
Etqaqd mri hagiu wataswaw ww rsi doszRxueheSeuq() gidcpuoz yo e cexaovmu yahceb qowegm. Ybud, pjupd cde zopoa mmuguw ik fku savomc tuheegpu:
fun main() {
val result = findSquareRoot()
println("result is $result")
}
Zgob see gil zpo reji, djo covwowajj uw snabyaq la qfi zkjeup:
result is kotlin.Unit
Kve feyou vzenav aq bpe huvurw yezeibfa ip Awiq. Ip a nojxseit fiegv’c sahops i cahau, eqz qevaqh zxte hidk ezkirf zatoasg si Ehec. Tao’vz dioxl xitu ozoih tamegxoyl royiaw ngin lokxhuiqb of o jedaji jazcux.
Wqeb rijjdeyub hnuh gape. Xiri so tva xexy bazz ap vba tomebe dug a piobj sisdelb.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
In this demo, you’ll demonstrate how to create and call a function.
Cinema mode
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.