Landry Norris
04/19/2022, 3:25 PMLandry Norris
04/19/2022, 3:26 PMCasey Brooks
04/19/2022, 3:51 PMLandry Norris
04/19/2022, 3:59 PMYoussef Shoaib [MOD]
04/19/2022, 4:22 PMrun containingScope@ {
repeat(250){
if(someCondition){
return@outerScope Unit
}
}
}
Landry Norris
04/19/2022, 4:28 PMRuckus
04/19/2022, 5:07 PMvar tries = 0
while (someCondition && tries++ < 250) {
...
}
is probably what you already tried, but it seems like the most straight forward solution to me. Not sure why you'd want some other construct for it, unless I'm missing some context.Landry Norris
04/19/2022, 5:13 PMrocketraman
04/20/2022, 5:00 AMgenerateSequence { task() }
.takeWhile { someCondition }
.take(250)
Landry Norris
04/20/2022, 4:47 PMrocketraman
04/20/2022, 5:14 PMvar
. If the task is suspending, you use the same pattern with a flow builder e.g. flow { emit(task()) }
.