把两个参数写在一个方法中,编译即出错,这是为何?
public void Eatsugar(string sugar, int count)
{
if (sugar == "榴莲糖" && count <= 3)
{
Console.WriteLine("我不喜欢榴莲糖");
}
else if (sugar != "榴莲糖" && count <= 3)
{
Console.WriteLine("最多只能再吃2颗哦");
}
else if (sugar != "榴莲糖" && count > 3)
{
Console.WriteLine("吃太多糖对牙齿不好哦!");
}
}