let's say I have 10_000 test cases which map to a ...
# coroutines
a
let's say I have 10_000 test cases which map to a float
result
. I want to quickly find a test case, where
result < c
, where
c
is a constant. Is there any way I can cleanly structure my code to achieve this?
the way I do this now is just with a
var done: Boolean
variable, where each coroutine skips if
done
is true. Is this good structure?
b
you can just use cancellation
a
hmm I guess the biggest problem I am facing is there are several Jobs, but only one is going to return a value that will be used... is there a clean way to do this?
b
depends on what you're doing, you could use a channel to push the result(s), or select
a
ok, thanks
@bj0 the problem I am running into is still giving a result if none of the test case results are in the tolerance (i.e. return
None
)
so I would need to detect when all the
launch{}
Jobs are finished
b
you can
join
on them
👍 1