What are conditional statements in DART
In this article, i will describe about conditional statements in Dart.
The conditional statements
The control flow statements which allow us to control the flow of our program, rather than executing every line of code in order it appears in the program., and in control flow the conditional statements allow us to checks; whether certain condition is met or not. The conditional statements are given below
- The if-else statements
In if-else statements, if condition is true; then if part is executed otherwise else.
Example of if-else statements
void main() {
bool i=true;
if(i){
print("True");
}
else{
print("False");
}
print("Are you agree with if-else satatements!");
}
|
Output:
Example of switch statements
void main() {
int i=5;
switch(i){
case 1:
print("One");
break;
case 5:
print("Result is five");
break;
default:
print(" No case is match");
}
}
|
Output:
Ask Your Question
Got a programming related question? You may want to post your question here