forステートメントを繰り返して、i
から数を増やしようとしてい0 to 100
ます。
これが画面に表示されます。
私の問題は、メソッド(Mainではなく)で何を返したいのかを完全には理解していませんが、何かを返す必要がある場合です。
intを返したくありません。値を返さない関数を実行したいので、返す文字列がないと思います。メソッドタイプをめちゃくちゃにしていると思います。
メソッドでifステートメントを実行し、パラメーターが一致する場合は結果を画面に表示します。そうでない場合は、下に移動してforステートメントからやり直します。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Project5
{
class Program
{
int i = 0;
static void Main(int i)
{
do
{
for (i = 0; i < 101; i++)
{
Words();
}
} while (i < 101);
Console.ReadLine();
}
static string Words (int i) //<---Here I think I am using the incorrect method type
{//Which then screws up the method when it is called above. I have been going
//through method types but dont see anything that when called just perform a
//function and displays results.
string f = "Word1";
string b = "Word2";
if (i == 3)
{
Console.Write(f);
if (i == 5)
{
Console.Write(b);
if (0 == (i % 3))
{
Console.Write(f);
if (0 == i % 5)
{
Console.Write(b);
}
else
{
Console.WriteLine(i);
}
}
}
}
}
}
}