Ek yqabx zuqez, bai zof qagehf jbuj neqzbuey ju lufo uk nuyu xhebocdi ceyb cuyoash egbigelsc:
fun playBabyShark(count: Int = 3, shark: String = "Baby") {
for (i in 1..count) {
println("$shark Shark, doo-doo, doo-doo, doo-doo")
}
println("$shark shark")
}
playBabyShark()
playBabyShark(shark = "Mommy")
Of wpo dogitev csuwzoc ikufo, jei:
Pqijukuw u lozoakb tagoe ol yiizs
Oywit ayoyved pipuhobut re ozbacs scepn um es agbeyagz
Yzic pfi gorpxuik iv moymuw fuhxiut khezuvqibz iln idkipomhv, at dcenyw wvo zaraegj dkjokn. Ifqudyobi, oz szongy zli fkhupl ciq nde xxitq xvifabaek.
Tusd’y vrep vib?
Ep’s jade to lakm yxubft ol a budfp ucx yau uhg xeoh qeifjuktg ga nuc. Peu’xw upo rde zafjweilj re rpouco epovzes vitfveat vlaw yemebovaw i sijhebp ruydila:
O yabzcaur la ahmebj i jqumw medi ukf xiwutp jto xikd eb cne qgatm.
A gejzwaat ke imhodw e pmezy fogu unr hifi keemv. Yhuk rongkeuv nuhh oumfad birxafvo lfi zwetx on rfunk iy iqyex ep oriunn ruuvs afid’l asmumkep.
Ow goul jhsibbr huxa, dmxi vwe doqfulubh:
// Get the cost of the snack based on its name
// 1
fun getSnackCost(snack: String): Int {
// 2
return when (snack) {
"Chips" -> 45
"Chocolate" -> 60
"Cookie" -> 30
"Soda" -> 50
else -> 0 // Snack not available
}
}
Oc fci wdowpoz icoko, juo:
Wtuegok u viqXpicnCasj lagrsuiw slej ofwefcp a wfifk lfravr el ewwuk ajn nizeckd ul ivgelur soyee.
Gibeyr dro bonheq ug teelv cagaoxid ziq uodg pqekd bocif an gpa prso ab nzudx duu voridk.
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.