Dart 3 : if-else , switch statement

 



!= <><> If-elseswitch Structure <><> !=

if structure
if-else structure
if-elseif-else structure
switch case

   If structure:
   var name = 'Himanshu';
   if (name == 'Himanshu') {
     print(true);
   }

   If-else structure:

   var a = "Apple";
   if (a == "Apple") {
     print("True");
   } else {
     print("False");
   };

if-elseif-else structure

   var company_name = "TATA Motors";
   if (company_name == "Hero") {
     print("Correct");
   } else if (company_name == "TATA Motors") {
     print("Correct");
   } else {
     print("Wrong");
   }

switch Case

   var name = "Himanshu";
   switch (name) {
     case "Himanshu":
       print("RIGHT");
       break;

     case "Amit":
       print("RIGHT2");
       break;

     default:
       print("No");
   }