111,126
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace app1_1
{
class Program
{
static void Main(string[] args)
{
for (int i=0; i < 10; i++)
{
Console.WriteLine("hello World!");
}
int i = 3;
}
}
}
int i = 0;
for ( ; i < 10; )
{
i++;
Console.WriteLine("hello World!");
}
Console.WriteLine(i);
//运行FOR要初化变量i的嘛,因为for要使用i变量,你放到之后,他都使用过了,肯定没作用了,就和你不知道盘古是不是和画上一样的道理
int i = 0;
for ( ; i < 10; )
{
i++;
Console.WriteLine("hello World!");
}
Console.WriteLine(i);
for ( i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
//自己去运行这个代码int i = 0;
for ( ; i < 10; )
{
i++;
Console.WriteLine("hello World!");
}
Console.WriteLine(i);
//i的作用域不是在for里面for (int i = 0; i < 10; i++)
{
Console.WriteLine("hello World!");
}
{
int i = 3;
Console.WriteLine(i);
}