Questions tagged «mutability»

7
Swift使方法参数可变吗?
如何在不创建其他变量的情况下处理此错误? func reduceToZero(x:Int) -> Int { while (x != 0) { x = x-1 // ERROR: cannot assign to 'let' value 'x' } return x } 我不想创建其他变量只是为了存储x的值。有可能做我想做的事吗?


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.