Skip to content

Instantly share code, notes, and snippets.

@inamiy
Created February 13, 2023 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inamiy/76506d91578c98fe5385486f06fd7563 to your computer and use it in GitHub Desktop.
Save inamiy/76506d91578c98fe5385486f06fd7563 to your computer and use it in GitHub Desktop.
Didn't know `try x = ...` was possible. https://twitter.com/inamiy/status/1623625122652491776
func foo() throws -> Int {
1
}
func fooAsync() async throws -> Int {
1
}
class Foo {
var x: Int = 0
func bar() async throws {
try x = foo()
try await x = fooAsync()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment