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

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"); 
        } 
    } 
} 
主站蜘蛛池模板: 博罗县| 屯门区| 井研县| 武威市| 廊坊市| 桃园县| 合阳县| 古丈县| 新邵县| 滨海县| 伊金霍洛旗| 洞头县| 盱眙县| 巴林左旗| 和田市| 阳谷县| 维西| 凯里市| 福建省| 邛崃市| 方城县| 外汇| 安化县| 乐都县| 平果县| 河北省| 云和县| 新密市| 甘德县| 安仁县| 水富县| 昌平区| 大同市| 长治县| 饶河县| 武隆县| 太白县| 河北区| 宁蒗| 公安县| 荣昌县|