Avatar
おおっこれで 200 が 2 回出力された import Foundation final class BankAccount { var balance = 0 func deposit(_ amount: Int) -> Int { balance += amount Thread.sleep(forTimeInterval: 1.0) return balance } } func bankAccountMain() { let bankAccount = BankAccount() Task.detached { print(bankAccount.deposit(100)) } Task { print(bankAccount.deposit(100)) } }