官术网_书友最值得收藏!

  • Learn C# in 7 days
  • Gaurav Aroraa
  • 75字
  • 2021-07-08 09:51:28

Nested if statement

Nested if statements are nothing but if statement blocks within if statement blocks. Similarly, we can nest else if statement blocks. This is a simple code snippet:

private static void NestedIfStatementExample() 
{ 
WriteLine("nested if statement example."); 
Write("Enter your age:"); 
int age = Convert.ToInt32(ReadLine()); 
 
if (age < 18) 
    { 
      WriteLine("Your age should be equal or greater than 18yrs."); 
      if (age < 15) 
        { 
         WriteLine("You need to complete your school first"); 
        } 
    } 
} 
主站蜘蛛池模板: 云林县| 五家渠市| 扎兰屯市| 东兰县| 泉州市| 彭阳县| 黔西| 寿阳县| 贡觉县| 湘乡市| 安吉县| 略阳县| 西乌| 南召县| 合阳县| 勃利县| 清镇市| 洛阳市| 扎鲁特旗| 平塘县| 宜宾县| 吉木乃县| 崇仁县| 大同市| 衡东县| 九江县| 大同县| 昌乐县| 池州市| 靖边县| 星子县| 盐边县| 清徐县| 金秀| 通榆县| 阳朔县| 巴林左旗| 响水县| 东阿县| 中方县| 兴安盟|