if=>do while()
public class 丑陋的代码ifelse { int old = 35; string strMajor = "Science"; bool bIsPassChoose = false; bool bIsPassInterview = false; public bool isFF() { /* bool isFFt = false; if (old > 35) { Console.WriteLine("年龄太大"); isFFt = false; } else if (strMajor == "ss") { Console.WriteLine("专业不是科学"); isFFt = false; } else if (bIsPassChoose) { Console.WriteLine("Choose not pass"); isFFt = false; } else if (bIsPassInterview) { Console.WriteLine("Interview not pass"); isFFt = false; } */ bool isFFt = false; do { if (old > 35) { Console.WriteLine("年龄太大"); break; } if (strMajor == "ss") { Console.WriteLine("专业不是科学"); break; } if (bIsPassChoose) { Console.WriteLine("Choose not pass"); break; } if (bIsPassInterview) { Console.WriteLine("Interview not pass"); break; } isFFt = true; } while (false); return isFFt; } }
//多个if可以使用dic字典。记住
//策略模式