Id 需要迭代方法中的 i 作为 Iteration() 的返回值....目前它错误地说它没有返回值。我假设它在 for 语句中。
using System;
class Program
{
int i = 1;
static string globalValue = "I was declared outside any method";
static void Main()
{
for (int b = 0; b < 101; b++)
{
Console.Write(Iteration());
}
}
static string FizzBuzz()
{
string f = "word1";
return f;
}
static string Buzz()
{
string b = "word2";
return b;
}
static int Iteration()
{
for (int i = 0; i < 101; i++)
{
return i;
}
}
}