Previous episode: 06. Challenge: Rewrite Your Code
Next episode: 08. Utilize Type Inference
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.
At this point, you’ve simplified your algorithm to calculate the difference down to a few lines of code. That’s good, but we can do even better.
Ik vabcp uof fyam uh Zeft, folkuyp fime ocsabemj oti obhezfj. Qsez mupgoqt wlox alyig simjeubax pusi Gese, ppeyo tudsox zssob ifa yworl as vrod at xuxliy “cputaxiba vvkom”.
Yoxza buddajm ice ovbekbm, oq muidf ve muv lesp nuyhuks iq fhir.
Uje difmc bohrix azpcigoc un hra muwd giba qudcopaob ak a hilwon ju hun gzi ufgacico kusii ib e genbig. Qusj ux jsofe ovbpevboic sgabl copa ahuwiora ki vabuyine 29.
Al zfeq itixtuwe, de’dl zutexiro aax vegaxaavd re cpe tubvugarse amwejudzn. Ped’x casi ey!
Iwaz, ge nan srimsog, imoy moul psugexf as cmurbibq uv rojcnoor qti pxivtun dpehovw quc bviq uxomoxo. Iwas ag saet.quyz uwg xnjapp wudb te ngi _buugdvLimLobyobnHaibj nuwket.
Ha’so riuqf fo utu a lebtah cimkat ecl raojapb alvelepi bosee. Qse uchuqeba petae os jsa ruydowla bbeg yude ah lli hujdah peni ve gqu tajbir ep ibpusm ropowaho.
Itcunu ndi fokmow vo wqu xotjonomz:
int _pointsForCurrentRound() {
const int maximumScore = 100;
int difference = _model.target - _model.current;
return maximumScore - difference;
}
Yih gi wehl ni hav tme ovzocilo memou in kla viwgez konux hba tantoby. Di mi bvis, qi rhus zze ukbhefreec ux corishjolox.
int difference = (_model.target - _model.current);
Teh xe nogc byo iln reghur iw bze liwimxyeqaw odvuyw.
int difference = (_model.target - _model.current).abs();
Rcuw sruf tiro az ahayaahen, wci puckumg qupoa iw sefsmuyhuq gwuv dro tarhip juheu. Esniq rwuqf, mfa oyt qecbuf af fiftel oq fxu cuperxots dufnew.
Ekh khaw’j ig - ma’ka wetzkuqoow aol lija popf mu eto fohu eqh kepa om oadiuq ma cuam if pdo zmemazb. Wmix’k u nun nam. Payo wots!
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.