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

  • 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"); 
        } 
    } 
} 
主站蜘蛛池模板: 澄迈县| 三门县| 丰顺县| 醴陵市| 兴和县| 涿鹿县| 米泉市| 甘孜| 河津市| 山丹县| 婺源县| 革吉县| 安龙县| 珲春市| 汉寿县| 五河县| 荆州市| 台南县| 布拖县| 岗巴县| 叙永县| 仁寿县| 吉安市| 沙河市| 朝阳县| 绥化市| 贵南县| 东至县| 炉霍县| 佛坪县| 白银市| 灵宝市| 隆昌县| 娱乐| 霍林郭勒市| 安化县| 凤台县| 西贡区| 察雅县| 安福县| 宜都市|