iex
01/09/2020, 12:48 PMribesg
01/09/2020, 12:51 PMribesg
01/09/2020, 12:52 PMrepeatWhile
, it would see logical to me to use a function returning a Boolean insteadiex
01/09/2020, 12:53 PMiex
01/09/2020, 12:54 PMribesg
01/09/2020, 12:54 PMif (!f()) break
ribesg
01/09/2020, 12:55 PMif (f()) break
, whateveriex
01/09/2020, 12:57 PMiex
01/09/2020, 12:58 PMribesg
01/09/2020, 12:58 PMribesg
01/09/2020, 12:59 PMf
and have a function to stop the loopiex
01/09/2020, 12:59 PMiex
01/09/2020, 12:59 PMiex
01/09/2020, 1:00 PMiex
01/09/2020, 1:01 PMMarat Akhin
01/09/2020, 1:04 PMiex
01/09/2020, 1:06 PMStephan Schroeder
01/09/2020, 4:56 PMfun retry(maxTimes: Int, f: () -> Boolean) {
for (index in 0 until maxTimes) {
val wasSuccessful = f()
if(wasSuccessful) break
}
}
iex
01/10/2020, 1:21 PMdarkmoon_uk
01/14/2020, 6:55 AMiex
01/14/2020, 9:19 AMiex
01/14/2020, 9:27 AM