Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftactors and actor isolationSingle-choice MCQ

Two tasks concurrently call `increment()` on the actor below. Why can the final value be 1 instead of 2?

actor Counter { var value = 0 func increment() async { let old = value await Task.yield() value = old + 1 } }