[英]'For' loop in Swift error?
Here is my 'for' loop: 这是我的“ for”循环:
let size:Int = 64
for var z = 0;z < size;++z{
}
I think the syntax is right, but the compiler always tells me: 我认为语法是正确的,但是编译器总是告诉我:
is it bug or something?
是虫子还是什么?
ps: Xcode version6.1.1 ps:Xcode版本6.1.1
From your screenshot, it looks like you're inserting code in the body of a class directly. 从屏幕快照中,您好像直接在类的主体中插入代码。 You should move it to, eg, the body of a method.
您应该将其移至例如方法的主体。 Then it will compile fine.
然后它将编译良好。
I would still encourage you to insert spaces after ;
我仍然鼓励您在后面插入空格
;
and :
for readability, however. 和
:
但是,出于可读性考虑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.