Sam Garfinkel
05/28/2020, 8:45 PMzak.taccardi
05/28/2020, 8:45 PMSam Garfinkel
05/28/2020, 8:46 PMflow {
emit(page)
if(page.isLast) {
cancel()
}
}
Zach Klippenstein (he/him) [MOD]
05/28/2020, 8:46 PMflow
builder (or callback/channelFlow
), just return from the lambda. You don’t need to cancel.zak.taccardi
05/28/2020, 8:47 PMflow { .. }
lambda completes, the flow cancels automaticallySam Garfinkel
05/28/2020, 8:47 PMZach Klippenstein (he/him) [MOD]
05/28/2020, 9:04 PMwhile
loop, but a lot of the iterable/sequence operators have a WithIndex
or Indexed
version that does.