[英]Objective C Char for loop
Whats wrong with this for loop in Objective C? 目标C中的此for循环怎么了? I get an "Expected Expression" error 我收到“预期表达式”错误
for (char c = ‘A’; c <= ‘Z’; c++)
{
//Do stuff
}
You're using the wrong characters to brace each char
, possibly a result of the type of keyboard you're using? 您使用了错误的字符来支撑每个char
,这可能是您所使用的键盘类型的结果吗? You need the single apostrophe character to denote a char
. 您需要一个单引号字符来表示一个char
。 Try this: 尝试这个:
for (char c = 'A'; c <= 'Z'; c++)
{
//Do stuff
}
Did you by any chance copy and paste it? 您是否偶然复制并粘贴了它? The code reads fine, but is wrong because you've used 'A'
rather than 'A'
. 该代码读起来不错,但是由于您使用了'A'
而不是'A'
而错了。 Change the quotes to proper single quotes. 将引号更改为适当的单引号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.