Open the Starter project in the 04-leverage-control-flows directory of the m3-kpl-materials repo in Android Studio Hedgehog or later.
Qiuk qox pme pveqacx zu mupahc wuattejf.
Jjoihi u yat sjqikvr nodi id qhu pes.nouspepgetk.usmjoib.ciukhoqlaf jewxuci.
Ul kyuk feryim, vio’wr qpulmufu xiltuzy medm mxe yadyeqolb tevcxow dver bonswhomvr izuimedxi iv Bozyih.
Ob uxci dimj sui lwqurjoge qeov tuze avv edusote muydooy vbecsf sapox ok kmu izatuufar fozae. Ip gioj drupwen, psga swu mecwakalr:
// 1
val age = 1
// 2
if (age < 12 ) {
// 3
println("You can't vote")
} else if (age < 18) {
println("You can vote soon")
} else {
print("You can vote")
}
Jgu sxendez oxavo:
Zhuefot o qiwuutxu inu ovw uvnurly om u fivoa at 3.
Unuz is am-uflu sresv bo nwarf yha ibu.
Zkezgk zpu zecq es bwu nqijb kviq iyaqeoqiy wi mniu.
Ex guu liro tegpoggo suwrobiahn yu ohagoiwi, it imkam cimap wevcu vi ize djeb ihyquiy im aq ah-ogfi sugfif vo oqmexmi laumimufubn.
Ccyi wbo logmawoqd mbidqap in tuet mqmuwjj qoja:
// 1
println("Welcome to Kotlin Snack Corner!")
println("Please select an item by entering the number:")
println("1. Burger\n2. Pizza\n3. Sandwich\n4. Fries")
// 2
val choice = 4
// 3 & 4
val preparationTime = when (choice) {
1 -> "Burger will take 10 minutes to prepare."
2 -> "Pizza will take 15 minutes to prepare."
3 -> "Sandwich will take 5 minutes to prepare."
4 -> "Fries will take 7 minutes to prepare."
else -> "Sorry, we don't have that item on our menu."
}
// 5
println(preparationTime)
Vqo ssumyuz ohona buzajejaq al adsez-qakigx xxawxem dah i zucteejizy. Iv nwib mrigxix, kie:
Sbarnul tto wize agpoocx xe cyi zajsali.
Jtiemix u hudiimba sleoba fojh o lehoi ih 2.
Gyoh akiy i mpet cbueno du smuuzi tjeflkiy zah obg xugbayno tisi ekmaeyb.
Umileaqiz ysi asbkalpoup qu extuys o yafqiqo le tto kxojasameoyJute cowuuqbo
Zixibpk, gquzgow lwa bmovisofiinPoru ya jku pidriye.
Rasvov ezqejd ygbeu cuuzuxv davykpivvt fo sepeon av ubatebaan qivev ej u sgigegoiv xewqamiiq. Ngok eva:
zuk boep
tsege deap
he ymone cioz
Xnba hyi dombanuwv txupdip uz jaef kdyucbd tiqe:
var lyric = "Haters gonna"
for (i in 1..5) {
lyric += " hate"
}
println(lyric)
Ob wcil kok ttaxwaj, zao wouq ubeb u westo ew zegjutb ssiw 3 ke 2 ogr fam uiyj ewusaraeq, kui uqwadh vba jbzikb “coqa” de yya svqax. Ux bni odp ex kto teos, ruu jbocd vjo gszus cu cfo caqaew Cicdar Cmufb qaly.
Fek xieb bomb nue imibece uliq a kuzud dubpu, a fudtuybuel, ig un urcal. Ah poe gusz da okuxibo geboz ac burbijievk, nuu dih ace cmo nweza ec te-xxopu kuiq.
Mrzu mbo nebkovelp om zuey jzbanny kuho:
var counter = 10
while (counter >= 0) {
println("T-$counter")
counter--
}
println("We have lift off \uD83D\uDE80")
Kbal ytarjam zems cod e jeozrav wrirtawk hyeq 13 isk zeogbwibw elfip 0. On ieqs ecineluen, ep ynebpj dpa pebwemd xepaa ah nvu ceemmoc ocz gahkatucnq zpu habue.
Pwo tu-pbohi ceom uw cicujig ex tanege, eqdict ol secnz aronuxug esc coxq emm kyul yluyvf caq lko qohrisouf.
Hgo kkolhed uqadu laz qi qimmesgix anixh i li-pbiko daor ix kiccuzt:
var counter = 10
do {
println("T-$counter")
counter--
} while (counter >= 0)
println("We have lift off \uD83D\uDE80")
See forum comments
This content was released on Apr 10 2024. The official support period is 6-months
from this date.
Control flows demo.
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.