Skip to content

Instantly share code, notes, and snippets.

@SebastianBoldt
Last active February 3, 2022 18:58
Show Gist options
  • Save SebastianBoldt/d762a871d74b688e8b9693fc85e3a844 to your computer and use it in GitHub Desktop.
Save SebastianBoldt/d762a871d74b688e8b9693fc85e3a844 to your computer and use it in GitHub Desktop.
let task = Task {
for i in 0..<1_000_000_000_000_000 {
guard !Task.isCancelled else {
break
}
print(i)
}
}
task.cancel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment