Consider the following (silly) example:
func u () async -> UInt32 {
let r = UInt32(Int.random(in: 1...10))
sleep(r)
return r
}
func v(_ x: UInt32) -> UInt32 {
x
}
Task.init{
print(v(await u()))
print(await v(u()))
await print(v(u()))
}
All three lines in the task appear to work. Are they equivalent, or are there any pitfalls I should be aware of? Thanks.