if 加括号与不加括号的区别

加 大括号是表示 满足 小括号中条件时执行的。  而不加 大括号,则表示默认的满足条件时,执行后面的第一句话。以分号结束。
if(   ){
    表达式1;
  表达式2;
  表达式3;
  表达式4;
}
表达式1,2,3,4 都会执行的。
而不加
if() 
  表达式1;表达式2;
表达式3;
表达式 2,3  都不会执行的。因为不是后面第一句。

  while ((line = sr.ReadLine()) != null)
            {
                //1.去掉空行
                if (string.IsNullOrEmpty(line)) continue;
                //2.必须是A后面的行
                if (line.Contains("A")) isA = true;
                //3.每行必须包含. 长度大于10个字符
                if (isA && line.Contains(".") && line.Length > 10) list.Add(line);   
            }
            //list实现数据后,设置完成天数,
            Console.WriteLine("输入完成天数:");
            var days = Console.ReadLine();//天数
            int num = list.Count;//单词数
            if (int.Parse(days) >= 10 && int.Parse(days) <= 100)
            {

                int daysword = num / int.Parse(days);//每日背单词数30
                int number=0;
              
                for (int j = 0; j < int.Parse(days); j++)
原文地址:https://www.cnblogs.com/wangcongsuibi/p/8857113.html