- 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"); } } }
推薦閱讀
- Mastering Zabbix(Second Edition)
- Spring Boot開發與測試實戰
- Learning Chef
- Vue.js快速入門與深入實戰
- 硅谷Python工程師面試指南:數據結構、算法與系統設計
- 深入淺出React和Redux
- Mastering C++ Multithreading
- 零基礎學C語言第2版
- 網絡綜合布線與組網實戰指南
- Python繪圖指南:分形與數據可視化(全彩)
- Slick2D Game Development
- HTML5+jQuery Mobile移動應用開發
- Python GUI設計tkinter菜鳥編程(增強版)
- C語言解惑:指針、數組、函數和多文件編程
- 程序員的算法趣題2