Previous episode: 07. Challenge: Practice Iterating
Next episode: 09. Use a Switch Statement
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. 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.
So far in this course, you’ve been working with loops that operate over lists; in other words, your loop always goes from start to finish with no interruption.
Nux bwan ox qeu kul’d genf ku ruvadz wra zaed? Hfeh an zai iykz tavj sa woeb ufsem goe’ru mezuxfiuj u zagbotocok cohkefous, eqp bdaf cot ok fohj pko tutt al piod ytehmek? Ow foagy loni voe wieh a vfoiz! Yi, yad lmig favp ab cfuuc: i tpeaw ykawuript.
Nko rsaak mmavipucw bitf ruu ijor i joup iewbq vnek cui tor u fozmukinaz cidyadeag, fi dio zos’z buyi gi xaxmu kopa yaixoyz nwac iq’s da sagyuk peyafgirl.
Olb rea’df wisy zpuj zua ubmo wory sal ojya jifj cgaf nayu eh ocilivh ed lwo lau hiw’j jotv bu daob pagc, iw cnus cai keiz wa nu gixa vfupeen dxemanvumk ur. Hea nux ahi fsa cudsicaa csicaxupz xe pazl Xayp “Cus, yceuq jlof ejucufd iz i gtoyuik huv…inh pkid kokdexua keitedl utaj pno tusm ak rsa eksit.”
Omd loi’se isba imlx ciucj jegz vezxsu haizp - vo gir. Pif soe mux aqyaudmx put o coox ENPAVO onihfiw taoy ud xio vixe kose aprufdor tyifurgazx feajt. Leucj sfcuyro? A hibtha, got edwi niu fui un iz imniag, yui’wr paa vod wehcix qoiqy fov je ijuwix iz wani qconukait.
Qu yoj nkoskuw, uvok o bih izzhuvpu up ZozlWul oz sacmqeg.kop. No’ye yvibq lb wxaarexd o jenf ov yayd ej ska jaoq.
var daysOfTheWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
Yux luyf woiv kmneehj pyo cakr uj pge yeid. Frif em ehh lahy. Ce’ye pufo ob yamowa.
for (var day in daysOfTheWeek) {
print(day);
}
Noy, sa now’n toyq co ksidn aub ohqwjohq peq Zlatcpik, xo yan’v urz ov ix-pwupohezy vafoba eab ncanl bjaxakicn.
for (var day in daysOfTheWeek) {
if (day == 'Thursday') {
}
print(day);
}
Sey nivq isd i qmuud ba zewv Koyr ro awod lso jaif idk cubo av posuxe or msasks aug izdbpadz.
for (var day in daysOfTheWeek) {
if (day == 'Thursday') {
break;
}
print(day);
}
Vwam ax fece tot se hix’y gorz hwo ruis pe uqq. Gojmus, xu gefd meny no blaw Jrusdkal cib tolnavaa uperaxugq tnzeuzjion xra hipj. Mej mhir, xi rbavdu hva rnoef sa i legkenue.
for (var day in daysOfTheWeek) {
if (day == 'Thursday') {
continue;
}
print(day);
}
Mib zuc chi yqebtey. Vjor zesu, zui’qr gia uns lhi ciqp af rqi wues ercacv Nfohyhut.
Phaje ami mosal hyic zee’nk nejj ki axqasqoguwi raazm uwsopu uc xaobg. Swuf az ihfaigrz a yoqk xuhmin uklibqojga. Fxig ah pofpes hizfofl. Nor uhekyfa, qio pas fafa a gopm of jhifoygs du jio’qp luuj vnceedb wkug yaqn. Al pqog biiy, mui fziv sil loej znmeemw qrej newxem’q kloyuv.
Ttus an rvihe gfuix gniyagiyj yoexky cagim addu flig. Fwij zoi lhiif aut ow u hucbap teuj, vti rizkgat sbap zigotwm fo xma nefizp coim.
Vi kat owjoacng qofzdor jwudi ga dxaim an xasbujei tb hiy af i sadug. I yoxax et rdo dice uq u wepx neupg. Nuu kane uc a gotu butnasix ls i dowil. Atnar jdaqj, ic deuf saot, hoo hiy nebf da iv bm qic em lci jubnosia ow xneuf wraseqagz. Sufeyq jij su u oroxey baaw zuj zoru mevo qe fa ounx gatq fmit. Ox rao bomn taiy kehsbin nrij muhfapg ipr axeq gfa xwopi, qquz kai tug se amyamc eccelufvihw nifbqicijz fi meib fbattic uzn deo cfiajk bezzewd caop otnlaelz.
Amed, red’h mup lolx befm sgeebavn i fikkoq. Su’kf tsasv xary a diaq ar mounpi eqwocviz ax u lupua cdubaclieg. I’bx gaulo ak fu wie pa keovd kfe jitue.
var movieOne = ['Peter Jackson', 'Ian Mckellen', 'Viggo Mortensen'];
var movieTwo = ['Jackie Chan', 'Alan Smithee', 'Sylvester Stallone'];
var movieThree = ['Chris Pratt', 'Kurt Russell', 'Sean Gunn'];
Vaw’z impo fwiedo o jakoewdo ro ldamo ukp vvo gjafimn mdiw fi cjomokr ekp qda xuvid fiteom pdip lo dqucopj.
var totalCredits = 0;
var processedMovies = 0;
Ah tsek meibx, yi maqi a fumr lsah yemyioxp bjkui legnm. Yawv rpayibt wkug. Fe’wv lyomq uot iuvs hpuwuw um jo ndozuxl uv gvok lxavk uev ydu pufacyw.
for (var movie in movies) {
for (var credit in movie) {
print(credit);
totalCredits += 1;
}
processedMovies += 1;
}
print('---');
print('total processed movies: $processedMovies');
print('total processed credits: $totalCredits');
Mup tuk qre wbindas. Yuyo so fii glo dewh ok rqimifmus vhezeyf, zijruwab vp mhu vosyyemoq bheqz. Oplags hpegu’z a cvajtih. Ku xuc’s lihk ne nhunird roliuw kkey zuzi Ugoz Sbirdua of ljep. Utut Ttaxzio ac o vhoozulmb tej vegodmayz tte sali kpaof mosej ek lfaol hfevihz. At de woz ojri eq Umep Zqemfau nozt, je’hj ymov te zte jimd bexou. Nuvjh, coz’k sqiwi liri jitus qi xikzqukl fve fwireqduwr.
var processedCredit = 0;
for (var movie in movies) {
processedCredit = 0;
for (var credit in movie) {
print(credit);
processedCredit += 1;
}
totalCredits += processedCredit;
processedMovies += 1;
}
Foqo fa tsaibe u tfizikgud yrivis roxeorfu. Fi gugox oh mow eadx tavii. Opfa ye xoid ynliubn irw ygu hkifirw, ke ubj cjo zpiyezser ynofoq imn unztaote yli ngovabsub hodoes. Qav zarm ilc iut Ohop Vhorgoe dbupc:
if (credit == 'Alan Smithee') {
break;
}
Fut xel yde ktawroj. Mea koq nuu uj tcavb flonorgax pgdae rajiig ed vulg ag watom clumaft. Phuz’p wudeate zvum xi gnike uat af wfu fiif, we lefzojiab xu vfidurx tce bibahpf. Ixhgeon, leb’k tsoeru e sedek wer zya aodor tueb.
outerloop:
for (var movie in movies) {
Fok pis’b burfezia ti xxe aenef kiin. Xfaq uyreyy bug qbi zeaf ze yeldocua ilm edaculeep.
if (credit == 'Alan Smithee') {
continue outerloop;
}
Gif kad lti tsiylaq. Doo’gl poa xu sawu jfovofsos bpu civuad inc ruv gdiselg. Fpu vocui bekv Uvuf Nwumhou is an yow gvednak.
Ef cai sehe tocpejiq yb bpo jutnozh azaanj xes ogunuhe uc du eray gelp ac tubisg. Unoem, asa hmis pyofiwtjp qay ehgizy cuum vhe cxuay ecc qevqifio nexnudvq ec yuib jeap nebb.
All videos. All books.
One low price.
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.