Hi!
At first I updated syntax of coroutines as shown here:
Coroutines 1.3.5
Then I implemented the mentioned below:
fun fetchCharacterData(): Deferred<CharacterGenerator.CharacterData> { var str1 = 0 var res = "" return GlobalScope.async { while(str1<10) { res = URL(CHARACTER_DATA_API).readText() str1 = CharacterGenerator.fromApiData(res).str.toInt() } CharacterGenerator.fromApiData(res) } }
but I believe that it can be realized in Functional programming style…