Yes, or even better, using some abstraction that allows you to run two computations in parallel and get their results, while also properly handling errors/exceptions and interruption/cancellation. See also the notes on structured concurrency, which are about such situations.
--
Software engineer, Functional Programming and Scala enthusiast, SoftwareMill co-founder
Love podcasts or audiobooks? Learn on the go with our new app.