I know a guard statement can be used like this
guard let someConstant = someOptional() else {
// ...
}
And I tried to do
struct MyStruct {
let aString: String
init?() {
guard aString = optionalString() else { return }
}
// ...
but it doesn't seem to work.
I assumed that the let a = b
and a = b
would somehow have a boolean value that was false when it failed, but are guard let
and guard
actually completely different?