Waa maxay farqiga u dhexeeya Scala Future onComplete iyo iyoThen hawlaha?
Labada `andThen` iyo `onComplete` ayaa kuu oggolaanaya inaad fiiriso natiijada mustaqbalka adiga oo adeegsanaya wicitaan celinta. Si kastaba ha ahaatee, `andThen` waa la isku xidhi karaa, si ka duwan `onComplete`, waxay damaanad qaadeysaa sida ay u kala horeeyaan howlaha dib u wacitaanka. Intaa waxaa dheer, callback la siiyo `andThen` waxaa laga yaabaa in ay tahay shaqo qayb ahaan, maaraynta kaliya subset ah natiijada (tusaale ahaan, kaliya `Success` ama kaliya `Failure`).  Tixgeli tusaalaha soo socda iyadoo la adeegsanayo `andThen` iyo `map`:  ∀∀∀ oo oo defDemoAndThen(future: Future[Int]): Future[Int] = { fut.andThen { kiiska Guusha{qiimaha} => println{qiimaha} "andThen1: $qiimaha") } .andThen { kiiska Guusha ((qiimaha) => println ((s"andThen2: $qiimaha") } . { khariidadda i => println ((s"map: $i") waxaan } Waxaa } Waxaa ∀∀∀ oo oo  Marka `fut` ay si guul leh u dhammaystirto, "andthen1:...", "andThen2:..." iyo "map:..." ayaa lagu daabacayaa amarkaas.  Tixgeli tusaalaha la midka ah adigoo isticmaalaya `onComplete` iyo `map`:  ∀∀∀ oo oo defOnComplete{future: Future[Int]): Future[Int] = { futonComplete { t: isku day[Int] => println{"s"onComplete1: $t") } futonComplete { t: isku day[Int] => println{"s"onComplete2: $t") } waxaa la yiraahdaa (fut.map { i => println ((s"map: $i") waxaan } Waxaa } Waxaa ∀∀∀ oo oo  Xaaladdan oo kale, marka `fut` si guul leh u dhammaystiro, "onComplete1:...", "onComplete2:..." iyo "map:..." ayaa lagu daabici doonaa amar aan la cayimin.  Inkastoo `andThen` ay silsilad ku xidhan tahay, shaqada dib u wacitaanka guud ahaan saameyn kuma yeelan doonto natiijada ka soo baxda `Future`. Laakin waa inaad ogaataa: haddii dib u yeerista ay ku dhacdo khaladaad khatar ah, mustaqbalka soo baxa marnaba ma dhameystiri doono.