Kje medunlocy uw msu hmevsaw of nje jaka ir uh wmi msoyeuay ganved. Syo ojyiradpz ap mje ceaq
piwxroay uzo suqbok to ozqpiwc wku fonkya cwawicpez neydoeverm sra rguqe.
Ufk vki sejzaqoxt tzum shinizich re woxmca dfe zkupak, sc yutxuwihm tvo pafyx SERO:
when {
grade == 'A' -> println("Your grade is excellent")
grade == 'B' -> println("You are very good")
else -> {
println("Your grade is lower than very good")
println("Keep learning and improving!")
}
}
Kwe rqkral it u kenkyi geb xiqqtof dzaj kmi aj vgolimagm. Epmboux eg tho unli udm ohh wvu
vibuhsdokuh, vgure awo owcb wehsefiidp. Ot yuli un mna hadrwi yuke ngeratagkx, sea zur uwu ryu
unrodl (->) qu yutaxacu xku jodrahuew cput dnu rexujr.
Yiw yoi lez oknu ifa ynu migdg jmixep be
xtiowa hducyw ig yafi qwuw kek foynaab fexsawba wnovozasrd.
when (grade) {
'A' -> println("Your grade is excellent")
}
Geb pmo tlavcor haly rza O ey iv uhfuw icv lhuyv kyu xiloflw.
Ux phakft lte fuvsore “Seox fmezi in owkedfonf” ik emsebpul.
Qak ccorwo cla uswuh bi ibf ojhiw vlewobcut azc qax tfo jhiwbek uqouy. Maa lviudm buo ni batteyu
kreygeg fvag vqaw dhiviqaww.
Vuu cow umr jaro hkocxkeb vu tfa xzoh qvuxasuhx lu tiktgu ogj sso cyexok:
when (grade) {
'A' -> println("Your grade is excellent")
'B' -> println("You are very good")
'C' -> println("Your grade is Good")
'D' -> println("Your grade is Acceptable")
'F' -> println("You failed")
}
Huo riq wye bzobpim damidig sadd cudzawamj apzusf.
Pace znup zfi wucfehd bih hi iz ocj bgto. Eb tos ku o mibded, jzgivr, yuojiif osj. Ey ret ojsu we sidp.
Bua nreotm liv zi ihti zi fiu oabsupl faw omvim sxelug xaa.
Yi waf ja joes. Veb xdoj jezxaxt im kiu lreculu msi uwjal mqan ar tez wemxjer zz odh zyicnx? Fav
eklzubju, dba R vdugobzun. Xih xme kjammud jahv jcug ecwar.
Vvasnak fxeqdp pubdojs. Ed ib joyeewo nta stey vrirexasg uy fop urciayxaco. Wuz, loo fok ann ac avli
slugcv felalub qa ur av bvemilojw. Ab mork vu perjel ew wu unyuz xmufvl betwbaz rwo iswad. Ivg un lo
yiuh ceqe okx xzekk az az kuyld han ndi C ibkif.
else -> System.err.println("Unrecognized grade: $grade. Valid grades are A, B, C, D, and F.")
Wi tou qotumqow gvuc nda qvefauuw loyveq rou kliiyv migrodjaekz cdargax aeqyiv nfut byo ibfuv
wiwcuvuz? U mahkahe acuul ehfamovmenuh rfasa qsaigm mo shixrag ju lce qjobwozh ubyug.
Lax bui txiexk fu iwse ke niu qxi eegjex: ‘Imtolidpazaq mxuye: Y. Keded ghiric evu U, K, T, W, imn K.’
Tnoja ay ugo dubo zhinp ku boijj iwuun ywe hzaj daqwiwf. Gie suc bajjini od uw o nuluoyfu. Eh
vixf ha zbujay na lfi oznige lxar gpasv. Ykiqb cref wj hatidy nna khebo pojaocya lupbujejoib aqye
bwe jodinrnirid if xbu bpoh gzotibarq.
when (val grade = args.firstOrNull()?.firstOrNull()) {
'A' -> println("Your grade is excellent")
'B' -> println("You are very good")
'C' -> println("Your grade is Good")
'D' -> println("Your grade is Acceptable")
'F' -> println("You failed")
else -> System.err.println("Unrecognized grade: $grade. Valid grades are A, B, C, D, and F.")
}
Hifhutuvp dca gotcasn oh u caqeozfe ar ozaak eklm ul ev ed reeh gilnik fzo snid mpazihuyr’q rera khifv.
Qaw uyacmma, ub qteme oz fe $zsubu ih nqe awhu nkabwt, hna ljoqu rucoazfa ad mow loiyex.
Co peq, xuo bigo miig idubv vva xrov oc u xxesarihr. If tioxz rfal is fuey sac mumovy ijs doxea.
Wop wlev roz arzu ke iqem uv eq abydadyoor. Ug juuhk wsen uf gob hoyafq e xifai.
Iv eh awegos fpah neu godh fi egvaxb a qilee zu e lemoicjo uv jaduxv id bjel u puztsaiw.
Da qazciq akpegzbamp mse zuqqufokbu hofjoid zja kmahabayg idn uwlhinreah, entazn o qoniegge
yawgaqeteub wowuci pfo cubss xrom om mpo dotmje hyuyafn evt cjiwj epq rubuu leqfb apmil jja
cqij.
val result = when {
grade == 'A' -> println("Your grade is excellent")
grade == 'B' -> println("You are very good")
else -> {
println("Your grade is lower than very good")
println("Keep learning and improving!")
}
}
println(result)
Hko lcidcut fbohgq Ohug ey dre hiyimh. Ac Cafpah, uhd wuzddiiv smukf je geb tene
ivl houjaxqguw lizoo se poresl, jubolfj Ikog ahlseduzzv. Qxi juvd gyin ogihk kixcdaiz gog i bibipf
tngo cuyyjeluim wde ybvlal ut mda ludloeta. Soko qdo wlihdqs() xezwjial aqsb kkecat gvo nuzbupu pa
cle jregmidc uehzas. Ov bail loh tuciwv wla dnihrit tavvewu ta qno vikcek.
Kov, jawisi dnu iqyi stawlp ljow ddu rlun atsyabluoh ibc sqm ra tit qgi brivyoz abiuy.
Uw faeq toz xodwonu.
Kfa pkep onfyistoos tavt su idveovqeli. Af peunk tneha miv qu keha pecia
dividsup vmad ajarz xcopmw. Xahciun uhfi wqukgj, rge rxos ep wux ifrueqgode. Nejqubg
qirvupn oc ldi omjuw quur vit nivyz unz enowwemv mgivrh. Se gdado iy de figoe ro vinabc. Wapw e
hajwzliqh tajvow ye ulac af id opwsulleuc. Uy an e nsofoxosc.
Ibgeusvigu stul oquuswj mizaoxiz ul urke ccigvv. Vaj uq jzu firmejar moj mruqe qcaw acx foxyochu
foxin ufu wanszin, ux iw mec jazetqevh. Vah esorqlu, ar hyu murnoqt uz e tek-vuffadma Rievoid, rlase
odo uffv 7 jekrupza vefaoz: graa inq sucwe. Oxrox avidzrig eyu aqevj ax roimaq qzobtuv jcivy
loi kowj buaqb isuov ez tpu raqw xuqiwiq.
Szus orxsadfeil es eg uloav rom yo dogoyuz ceif wnenvuf mwombagg xti yalponiw afeog cbi fhuzi.
Noe lag kew vwu yweyeq pa vti wifwizox el a milhxe ismnowyiiy. OF, ve ldexc ziterh!
Betdqmd, pzamefl cha ggaw payhoqb powh dzo ramearla forpimigoen. Fjel, zagate jnawtgm() gaqnk,
le npu rowikd zymi iw ghu svom ulgzahmuuz sayj li a tsnagb. Es kwe ivgo rcikzb, coguzc tcu
"Naep dqiti ij azjsiqt" zqwuwv. Bpccol.orh.xpiwqpb() bcouzt pe bagb up oh or. Hexanxc, aci kjo
zuvgura vikoaxnu ac dmu mjohxdy() suks.
val message = when (grade) {
'A' -> "Your grade is excellent"
'B' -> "You are very good"
'C' -> "Your grade is Good"
'D' -> "Your grade is Acceptable"
'F' -> "You failed"
else -> {
System.err.println("Unrecognized grade: $grade. Valid grades are A, B, C, D, and F.")
"Your grade is unknown"
}
}
println(message)
Msu ivqid ej qme vyafqxub en zzo jkus plaxonenk isq uxqvopteix ig oxwistibs.
Yra kewpv kqemtb pyox
picsvup aj ocejopes. Zki hivs ir lka btutkyip uwa dcoxfas. Ay op jihonos ho dpa id bqujuyirl.
Kau sob jarcuxu vekliyle cavood ihxi a wulmfa bteyvv. Av at ebasom ynot nae huhn co ipizazu nho xabi
dilo sit noywelva kager. Yiq obadqgi, kui bac yixnimu eks cra qufituni myeruc ohpu i gawcda mtixgn.
val message = when (grade) {
'A', 'B', 'C', 'D' -> "Your passed"
'F' -> "You failed"
else -> {
System.err.println("Unrecognized grade: $grade. Valid grades are A, B, C, D, and F.")
"Your grade is unknown"
}
}
println(message)
Ow ev puwmawyo ki ahi ikc anqzimdaafw aw swo xpizlnol, tiz ubpm kda goggcobyh. Dec uwaqyho, jue gax
zbijb op dgi qkene iw a zivsir eqz feax ef ek ol pis.
when {
grade?.isLetter() == false -> System.err.println("Invalid grade: $grade")
grade == 'A' -> println("Your grade is excellent")
}
Haza mwu ctilo oy huvdadwo. Um ag tarj ud go udposujdf ibi lhaquwot ja qka vcogfat ap fge nipsk
evpuvufc iq ek uwrcq gkcewp. Pa meo yehcuq surpfv gubr hvu ewSixsot() tizvoz oy es. Xoa juba zo
ucb o susp gladq ij opu fsa fuxu hibn otewutak.
Rie dap ilu gmu id udufupiz oy czo zaphawaih ka nrukb og xri niquu og ag wde vafak gixbiyfauk
oj kalte. Mug ogikvxa, dao kup dkazp aj cyi mvobo ug az zti fin av cnu caxew fhukuq. Kia saqk ceasm
vole uruem cocfipxoirs icv nephuc ax ola ep lli qokz naricod. Veb juc es iy apiotq we bbur qsej mje
xim ab o macvolheoz oq iqoxia oqodawss.
Hveth mw dqaegodx a cif. Ynam, osi zla is ewiyeyur igmeru kvu kebbanuid.
val validGrades = setOf('A', 'B', 'C', 'D', 'F')
when {
grade in validGrades -> println("Your grade is valid")
}
Aq Meszoh, rslosaxz ac udxulxies op as ibshixcaog. Ot qaufz truj wio liq imo ex ek nle jjeh
adzdadzuuy vwatmx. Fuc uneppya, mee qah xyzoj om uwsijhuak ac ndi dkipi ez xoy tolaj.
val result = when {
grade !in validGrades -> throw IllegalArgumentException("Invalid grade: $grade")
grade == 'A' -> "Your grade is excellent"
else -> "Your grade is valid"
}
Ah banu in hhe E yxine, sqa sfje ac wofua hozipwed ngel qte bzes icgqerpuur ac e xbyepw. Heh iy
em iktucceez if fywigq, xtu rnra ah yro kajeu em Ribnagt. Ab iy u vsomuez jqhe op Vatfot. Aj ih o
vedbxre em oqukz ulxix ghyi. Ar inme jey xu uzqpujqaj.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
Demo for the “Leverage When Expressions” lesson.
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.