Skip to content

Instantly share code, notes, and snippets.

@knowsudhanshu
Created July 18, 2022 16:59
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 knowsudhanshu/39f8ee041945f83f7e30db10dc7e9582 to your computer and use it in GitHub Desktop.
Save knowsudhanshu/39f8ee041945f83f7e30db10dc7e9582 to your computer and use it in GitHub Desktop.
infix operator !!
func !!<T>(lhs: T?, rhs: T) -> T {
guard let lhs = lhs else {
return rhs
}
return lhs
}
var someVar: String? = "has value"
print(someVar !! "no value")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment