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

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"); 
        } 
    } 
} 
主站蜘蛛池模板: 海兴县| 扶绥县| 阿拉善左旗| 得荣县| 手机| 长治县| 万安县| 大悟县| 河池市| 安塞县| 陇川县| 荔波县| 乐业县| 永兴县| 富阳市| 金坛市| 澜沧| 麦盖提县| 子长县| 万载县| 白山市| 六盘水市| 涟水县| 陕西省| 隆德县| 天峨县| 宝鸡市| 屯门区| 禹州市| 潍坊市| 夏河县| 灵石县| 富蕴县| 新沂市| 佛山市| 普兰县| 克什克腾旗| 醴陵市| 邛崃市| 荔波县| 桐梓县|