其实.net c#中退出for循环的正确方法应当是:break
这个才是真正退出for循环的方法。
return是退出了整个类,而for后面的程序就再也不运行了。
下面为整个代码:
for (int i =5 ; i>0 ; i--){ if (i=3) { break; } }