Conditional

 /// Conditional Programming


void main() {
// var a = 500;
// var b = 50;

// if(a>200 && b<10) {
// print("Block 1");
// } else {
// print("Block 2");
// }

// if( (a>200 && b>10)
// || a==100) {
// print("Block 1");
// } else {
// print("Block 2");
// }

// if(a>200 && b>100) {
// print("Block 1");
// } else if(a<50) {
// print("Block 2");
// } else if(a>80) { //Here, condition is true
// print("Block 3"); //if the condition will true then it will not move ahead to check other conditions
// } else if(a == 500) { //Here, condition is also true
// print("Block 4");
// } else {
// print("Block Else");
// }

/// Condition ? expression1 : expression2
//If condition will satisfy then expression1 will execute otherwise expression2 will execute
// var c = 10;
// c < 5 ? print(true) : print(false);

/// Expression syntax : expression1 ?? expression2
// var x = null, y = 5; //Example 1
// var temp = x ?? y;
// print(temp);

var s = 33, t = 12;
var temp1 = s ?? t;
print(temp1);
}

Comments

Popular posts from this blog

Pagination with Bloc Pattern in Flutter

Pagination First Practical in Flutter

ExpansionPanel with ExpansionPanelList with Complete Collapse Operation in Flutter