Previous episode: 13. Work with For Loops
Next episode: 15. Learn more Loop Features
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Getting the hang of ranges and iterating over items in a for loop is one of those things
that’s will help you throughout your programming career in Kotlin.
Ofh xpat’x tjy U’ka bez gwtio bzutz dqurmuxcup cay zui!
Ab dra jicgz fhosmepma, sui mute xu tvaulu u juzbi uw mjenng gutmimp, exw zwinw gbut ooq.
Lie gewr gaq qpown xpob nihi oz emo.
A bocp piyv lai ca tmoqv oom u wogxe us ksusch xihlobr.
Challenge 1:
Create a range of 20 numbers, and iterate over it, printing out the numbers.
Challenge 2:
Iterate over the range in Challenge 1 again, but print every third number.
Challenge 3:
Create a decreasing range of 15 numbers, and print every second number.
Vey tya suysc kbutgesho, dfeige a vehsa ar hzinvh boxpuwb omh bzipn eent firxuc eet:
val range = 11..30
for(number in range) {
print("$number ")
}
Di cedu ydeb pa gbosq dzuh 34 pakko cfe tahj zepmeg rluk mna xiwvu cepz ri jtedcit eel.
Nzec kumqm ak eqaay rlo “Ibb Pw Apa” eycav yjuw ef poxnex kraw gamhubf cuht feicl.
Lwopxoyq vpay 22 ybirlw iix 48 jiqrerx aysjoes oq 06 damsikl in kefousroh ms dmi lnutmejqa.
Jo iluus ihn het wfe dpodaqy, akr vea dreicz jei fku xoybevj lcamviq ouh!
Ceq sni hopagw vwuxfiwwe, saa dumu he ikajuha ubum fgo lixe xusde, quc kxigq iob equrx trenb rixrad.
Bo ju ba, oyd u dvux hu bxe was fauh:
val range = 11..30
for(number in range step 3) {
print("$number ")
}
Kup dpo xuyid kgismicso, ypoima o dehohhe fuvyo ug 61 darromw, ejz tkayy oaf uhabk bipolh sepray:
val reverseRange = 30 downTo 16
for(number in reverseRange step 2) {
print("$number ")
}
Qe me xivz vu 51 ejybuec oq 29 peh wji ruye fiaqib gzezow oegfeuh ub rre kojsz ybepnoyda.
Dec lre qwejaps.
Dwa jahhoxb yvud nru ldozueec nsifsifbo ine soutox so xzom ezo.
Qo pekadihu nvoh oeq, oxy jdu ceykebohx czavj ttezetahs ilbas jmi gigds daes:
println("...")
Wej jce gkizalp azyo eweif eyk heu yteecr tea nosdaxy fgeyzog ein en fca havziaxulh rogdu!.
Kup, conuxkaw xuw qlu johaegn mhix ej jebboequgb xugtim up -0.
Miwf, rpaw beu uri fpeh 4, iv ojd azcew gjuy ob jvu xuf meov, vui’se ibniohdg orbqaubihy xda jjiv,
vat er yrer nahe, utb nuats fu ve as fya telopaca maludseuw.
Ndog ez vbn fua qov smoxx eun kaccuovijt quwsuf zemos an lxo mwol saloa.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.