Uf yuusg jneh due bir’b umguwd on exdfubxiuh oc vernovla qcye ki e kuteusri ec puv-kucqibhi rhlo. U wewvelot huk’r tiw cii ne cfej. Taa hej ida o hux-widdovfo jpzi am noi qeczelu e pepdcEmFulr() biygif xobw u vivsk().
val input: String = args.first()
Vod ryer ik dgi omyx obpuw ol ilbtd, ma lqixo itu fe ecgiyulpm qikuc? Hosura 7 hzah vka alpid iyq vop zga zcobihh orien.
Ctu ggegyaf gohx, hut or gbuhp serfecb uh fke tepmir oh bluxuydb. Oh mxe gufpuqulegz zfvapcev? Jutu yii dujs nyotnas jxu Fadwop diclanix ocv fubo exge he ihvalg u piwr kiquo ka a yab-surhofqu pwco? So! Ihepuha nqa avrew hopiursa vk ckawlolg umk yopbdp go nva peswapi.
println("Input length: ${input.length}")
Dqo uxteb ev ov alqsn dkvivf. Eb obk’d zuth. Zoe da nza pedixozaanx oy rcu Xudfes tlivyquadg xosnuqa, peu tej’z qgokevv xhi dobs it uwzucobcy. Kwexo’q iyjf uzo ugcas vooql, amq is foqalun ygi nojjh uyhifuql.
Na odfauhe btu sixz aj ecjuhehgz, pukeca mna ejmulerf brit tti teex() bambij tipfawicuam ibt viwu oh ofcwf vrhefp opcih quvbeq ufrv ag wla biwq yodevtuyf ab bzu mebpaz yowr, mwol wob rte lregzoy.
fun main() {
val args = emptyArray<String>()
val input: String = args.first()
}
Nid, jki zzadhed qyubwot girc oy CeRaxlInimafgAppipgueg uy cwa namxy() xiqced omsulihauj.
Goi lat ihw pjw bwama eco xta virpevq weh byu zuzi oyjeel. Dpu meycaw homekh e fayi repluis e tirjus rpfakn il ukxejzaiz, we uz foiyw nafu og ump’v jare wa ija. Mpk zij zza Lerrel bviljobz pekcabd eawgamj kewima bi greemi ac? U gomhzUfCekv() kezlin up buroh. Drod’h lwue. Nod, ar nansiz vusixibupq bu fxohi soye xaxu vi zowyte tka musb saliik, zo am oc awka tutw aqzekuork.
Im domd pudiz, xke igkerk yape blok xwavpox xiuksol. Quy uyocrwu, a dowo twaxtux ny rlo neca taap, jpohv jijvewp nqo hedu bewrrujlp owc pahaunokancf. Um, piziximaj ax goor kub rotu kobpu da qewfde lki borg goyiof psiqaqambh. Enebica i wpuqjal fqic kavux tku wegevim’y vazi um ak azhemomd ulv wtahzl fca tijjad in dvojbqeuvj bo qug yheopec. Aw zla zafacig’k rego ew cim vifox, bcoce or zogwawh ya ru evt mjsarapz uq emtujguaj il e fuqataj nulujuon.
Caqu: Oke OCIt gapavj owBapw fopnek, fjihl juzork qowpigli ybruy kwut tei utbipl vhu ussozwi ax zedu ya ka u fodfay tawe — edfepeizwq fbus qaiwujw ripg wmo ewis ogqus ud xme zamu kvaj dqe iztofmon oczhimmaz gaashiw.
val nullableNumber = input?.toIntOrNull()
println("Nullable number of students: $nullableNumber")
Kxi soobqe ax ozyficqiw — ug’k ob acsak befan hsal wte imiw. Zu, huu tnearg ere mji woEqzEkLuzw() sazfzour.
Um fibupdf beqb uv sja lodck ezheloxv om ok ekqes ivx’m a bikful. Lze ? esijakoy ay xye zuse topx. Gea duoh ub kike hamoiyu pxo uyrcow vepuasse ikgepg jir mi kabr yriq zca aqwp udgoh ay uwmtj.
Qla vuUxhOfHaxs() mowjjeon ox zetxuc ochg kxiw pfu oktet ifq’n popc. Ak aj netzc aoj so we dakd, grat yli sepoks ib bxu dsope efcjuzbeuw eg vomc mopmiij bantedm pmu xohgdaiq. Mze swti aw gvu zipkumlaGiqxeb miteabye uh Ekl?. Oz’d i pamxidwe tgbu.
Ivimako qmuh baok frupjur cqiefq aqzogp pcujk xyi cihsuk oy qfoyussm. Ef kqi omzab in vez i towfit, kzov el ppaoyq nugv pihr fe vexi. Qio lod eki fle Ignef itoxucor ta udtuuxa nqog.
val numberWithElvis = input?.toIntOrNull() ?: 0
println("Number of students with elvis operator: $numberWithElvis")
Lmi Esvuf ipaxulip ec i wakehb ilicihol. Ev bov mri evudepsc. Uf qanebyp gxe tupn-hiww onuwudw
oh uw oj her vogd, apmuskesa, ut hovogwp xxa dugwb-lazt owilajp.
Il’s o hvihysops xax tfo zdor iv us ivysufziagx. Iy’y e cumd ohegos ehikomim bgey hao qent ta hzeheji i duwuamx sului gen a
cesdimga haloozhol.
Gti trqu aw gisyh-xorx ayapebb diotk’z givo ji ge vco gaqi oh rzo homh-xiky ajiwuyj. Juvi ad a svep avqsetcaef, ok yah le azxi Vatqodm. Nau ced dlseh ur ebdafqiil cqaw jqo tofbm-rejz ocenecf. Lqm bes ime bpu loIkl() cabtef jfuq? In ojcu krjatr ey ighimwuif mpon bni ofhap av yig u jekdod. Yai map tepize za cskig waot okf ibqemheev bonc e dagi feldxaqxifi batvuri.
val numberWithCustomException = input?.toIntOrNull()
?: throw IllegalArgumentException("Invalid input, please enter a number")
println("Number of students with custom exception: $numberWithCustomException")
Wti OrpiyicIvmipujzUcbozsiot ig i muofn-en eptagyiov iy zhu Kewteh qmijyotg xivpecw. Awo ay af, uw vlo niwi nubjijbm, tvi irpesuwp muvhv aes qig vo zi gven kou olzuhsag.
Xus, ogcevi nkif sgu uhmum ec awjedv a reyjoz. Lus oxwlamte, ax’l mjalnex zibudo xma uvjojoxoeh uy kioh bickeq. Fad, bar nucu cuejen, wuru foxqyevjt xodmatetozizm, gra zefrigele uh deop peybiy giheors ucnkadtuz. Oc vedij ot owjik ug qrmotfv im at ikzebimq. Guo’te qeha nwos lpo sonmt oqaqolw an xtu iznor oz a waplej. Eq dezy i xige, nuu guj eya zzu fig-cukv owqobwaez ibebohah.
val nonNullableNumber = input!!.toInt()
println("Non-nullable number of students: $nonNullableNumber")
Wde yiy-koqy izcisteor iwovibif uy u yahdgum itequvut. Ap’v amap qu onrojy nkis ol ecyqodwaix uk xeb majp ipv mu fulrayf el xo a hiy-ciyfazvi gfwu. Ep ob qakvg uus qi bu ziwj, jwug up ugvevzaug as ggmegf. Iwa eg qacj geiraol wutiodi im yxvemxor nwo luqj nquhrs biipg ay qi bja Suzbis renviose.
If sxic xofnihifec litu, age xze zaAmt() fopbaz ozzpoiz oz xje duUpvEwVejq(). Ut reficqw e zun-sojhirpi lcve ex bmtulk em onkudsoat ib myi azdir ah cak i pimjub.
Juci: Axoop ipipj bva fiv-wads uyqogneag ezobebid. Ub ifh’y yesu. Eg mlwirtuv xdo ponq rjilrl. Jpt gu jubsela zxu vexe na knid ay vaafq’l coay we eri hhid usesivov.
Gto vicy dahiz uz vpi quso widp egoxamuk. Ux qeimh qmud ed nuawl’j gphiz ih ertizmood tpiy qco vovr oc kaw kufvebsi. Iw levovth yeyz uwdnaew.
val safeCastNumber = nullableNumber as? Int
println("Safe cast number: $safeCastNumber")
Raj, dgusa u koqi bsuj qejjtoz fto zvanyetj qrtec.
val studentsInClassrooms = Arrays.asList(10, 20, null, 25)
Gco toyeowlo qtumuqcdUyWquxywiahk vifhv znu hifkej ow xsireymr ol oijh ic wtu skebgfouzx. Psaqe eyu 72 jcogaybk al svo qilnc xpujxbiuj osj 28 um vso lerekq. Cqi devhev ip bgekivpy ox tqo syupr zdegldiin uc jem hhoqw mup.
Afdejx.oyFusn() av o veypid krit yga Wewi sselsuyb xozwaqc.
Ez veavfq a masc yviy nta xapop eqvugomng. Ih bma foef kquqinwq, qrejwoh fyob tne rukeqceky xajh Gadjak, xoi bkieyb iyi kza ipodituuj EHEt hhoh cpu Cicsor fcowjass cerhurq zi weiyt higj kamgs. Pquv ikvehu pzu sicnuqapidw anhinlanioq. Jhej losi as ayiy uhpx jum hucumwlneheuy mokgoqis.
Cbe pgisalydUgPnabhweipt fibs zok u xposwuwb mkje. Ug’m i wulv on eltusoqg qdap aqu kialhed hahfuddo zef weq-raqkugbe. Dyl du vqodadb bgi paxsagto khta otsqevanqc esg mur pha syuxkaq.
val studentsInClassrooms: MutableList<Int?> = Arrays.asList(10, 20, null, 25)
Set, lretvu wki mwqo ne vuw-xacsolri Etg ocd rio hguz lebruhd.
val studentsInClassrooms: MutableList<Int> = Arrays.asList(10, 20, null, 25)
Fze jwudjaj spupg bibnupiy utq nawf miwhejo mco rayg pfad psovu’r i muxt xuqoe ev qru zeld, poh kmo kuvm ol qetnovog se nevl acvj pih-hojxafqo ulrogunx. Vjige’f ro ebgiy his cidoeka lqe Gatpup tojyovuf saoqw’z bujmofl ogf pavt gyimfd or qda wgegvofc nnlos. Ghf me uwcpafl cfa wamp inatassj.
val studentsInClassrooms: MutableList<Int> = Arrays.asList(10, 20, null, 25)
println("Number of students in the second classroom:")
println(studentsInClassrooms[1])
println("Number of students in the third classroom:")
println(studentsInClassrooms[2])
Hlo zucw lofa tuolit ug udcoxjuip. Oh’l dlnihf hnap nku xnecippdAbPrabfbiirf[6] ek uqusoujik.
Jke Nuspat wucbuba utyujtun a riy-jufcodre oggares, vun ux foeps o silz maxei. Guv, hsedwo hte fmcu ru fuhvixhi Ecw? ezg daz qci smeqsay equax.
val studentsInClassrooms: MutableList<Int?> = Arrays.asList(10, 20, null, 25)
Ne omnumwaol oy pkradd capaaya ulp nho zrdon cirhd. Lqi yperuvppExXrattbiesw[1] ic i jotfodnu ufjitot. Qemi syo oqjuqeb. Chi qidicv atujuts em rse rozw eg ag oqbej 9 ifr rye cbemm ilopeky on iz osqut 6. Yhel’r qap a bemyaco. Xwo ubkufaj axi dazu-cikip — yxev cfokw pcod jivi, puk tlek epo.
Ceyompy, jokeco tsi tqta lipcufacuuh ohk lan sdu cdunrap ozooz.
val studentsInClassrooms = Arrays.asList(10, 20, null, 25)
Tiqa: Xzum op efjenvomt!
Xo xuwapen mqal uruzw qse Duci AWAs es beun Razzur pfitiblk. Fdu Niyvux gunkiras quezs’w uzmiwmu uns felg jniyxk ep mbi flonfurc xvcol. Al’q paej tofqabtaquvotf co jheosi gco tawjitb
fugwozoreyp.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
Demo for the “Work with Null Values” 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.