Nested If Statement Example Program in Dart


Example Program:

Here is the simple program for printing basic example of nested if statement in dart.

Source Code

import 'dart:io';
 /*
 *   Age>=18
 *   Gender='M'
 *   Room-5
 *   Room-6
 *   Not Eligible
 * 
 */
void main() {
  var age,gender;
  print('Enter Your Age : ');
  age=int.parse(stdin.readLineSync());
  print('Enter Your Gender : ');
  gender=stdin.readLineSync();
  if(age>=18)
  {
    if(gender=='M'||gender=='m')
	{
      print('Goto Room-5');
    }
    else
    {
      print('Goto Room-6');
    }
  }
  else
  {
    print('You are not Eligible');
  }
}
To download raw file Click Here

Output

Enter Your Age : 
20
Enter Your Gender : 
Male
Goto Room-6


Learn All in Tamil © Designed & Developed By Tutor Joes