2.5 Swift赋值运算符

前端之家收集整理的这篇文章主要介绍了2.5 Swift赋值运算符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

/**@H_403_2@

@H_403_2@赋值运算符@H_403_2@

= += %= *= /=@H_403_2@

@H_403_2@本质上是对内存的写操作@H_403_2@

*/@H_403_2@

@H_403_2@

@H_403_2@let@H_403_2@ b = @H_403_2@10@H_403_2@

@H_403_2@var@H_403_2@ c = @H_403_2@9@H_403_2@

@H_403_2@var@H_403_2@ d:@H_403_2@Int@H_403_2@

@H_403_2@

c = @H_403_2@6@H_403_2@

@H_403_2@// c@H_403_2@语言中可以这样子,但是@H_403_2@ @H_403_2@在@H_403_2@swfit@H_403_2@中@H_403_2@ @H_403_2@表达式@H_403_2@ c = 6 @H_403_2@是没有值的@H_403_2@

@H_403_2@// @H_403_2@在@H_403_2@swift@H_403_2@禁止连续赋值@H_403_2@

// d = c = 6@H_403_2@

@H_403_2@

@H_403_2@print@H_403_2@(c)@H_403_2@

@H_403_2@print@H_403_2@(c = @H_403_2@6@H_403_2@)@H_403_2@

@H_403_2@

@H_403_2@// @H_403_2@加括号都不行的呀@H_403_2@

// d = (c += 6)@H_403_2@

@H_403_2@

@H_403_2@/**@H_403_2@

6@H_403_2@

()@H_403_2@

*/@H_403_2@

@H_403_2@

@H_403_2@// @H_403_2@像这种就会报错的@H_403_2@

// if c = 6 {@H_403_2@

// print("ekyi")@H_403_2@

// }@H_403_2@

原文链接:https://www.f2er.com/swift/322500.html

猜你在找的Swift相关文章