Swift assignments inside conditions -
i wondering code does:
var something: string = "hi" if = "hello world!" { // executed? }
will assign something
variable , if
body? or set value of variable if
body , outside not change? or has nil
?
this pattern works assignments can fail — is, if you're assigning result of expression returns optional value. , in case, use if let
, not if
.
Comments
Post a Comment