Visual Studio c#for loop glitch? [英] Visual studio c# for loop glitch?
问题描述
使用System;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空间ConsoleApp19
{
   课程计划
  {
      static void Main(string [] args)
      {
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; for(int i = 0; i< 10; i ++;) //第13行,它预计我已经拥有了两个)和} b $ b &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; Console.WriteLine(" *");
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }¥b $ b &NBSP; &NBSP; &NBSP; }¥b $ b &NBSP; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp19
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 10; i++;) // on line 13 it expects both ) and } which i already have
{
Console.WriteLine("*");
}
}
}
}
这将无法编译,因为它预计已存在的东西,当我使用快速操作时它只是增加额外的括号并犯更多错误。而今天早些时候我正在使用for循环,他们工作得很好。我已经退出了视觉
工作室并尝试开设一个新项目,但同样的事情。为什么不编译或视觉工作室只是吮吸?
This will not compile because it expects something thats already there and when i use quick action it just adds extra braces and makes even more errors. and just earlier today i was using for loops and they worked just fine. i already exited out of visual studio and tried opening a new project but its the same thing. why wont this compile or does visual studio just suck?
推荐答案
>对于(int i = 0; i< 10; i ++;)//在第13行它预期两者都有}和}我已经有了
> for (int i = 0; i < 10; i++;) // on line 13 it expects both ) and } which i already have
for(int i = 0; i< ; 10; i ++)
for (int i = 0; i < 10; i++)
但养成了写作的习惯:
for(int i = 0; i< 10; ++ i )
for ( int i = 0; i < 10; ++i )
这篇关于Visual Studio c#for loop glitch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!