Dart Control Startment
Controlling the flow of your application is a key part of the any programme,
controlling flow means handling, what you programme can perform, do, and act.
(Decision making) ๐ง
if/else
if (condition) {
// do something
} else {
// do something else
}
Switch
switch statement means when the value of expression is equal to one of the case values, it will do that action.
switch (expression) {
case value1:
// do something
break;
case value2:
// do something
break;
default:
// do something
}
(Loop/ Iteration) ๐คน๐พ
While Loop
which means until the condition is true the loop with continue the task,
dont' over-complicate the code,
while (condition) {
// do something
}
For Loop
//for loop is modified while loop; in for loop you know when to stop.
for (int i = 0; i < 10; i= i+1) {
// do something
}
// same ๐
int i = 0;
while(i < 10) {
// do something
i= i+1;
}
if/else (Ternary Operator)
condition ? value1 : value2;
// if the condition is true, return value1, else return value2.
acces the github repo:
Repos
๐ค๐พConnect me on:
Twitter: ๐๏ธ@Abhayprajapati_
Github: ๐ง@theabhayprajapati
Linkedin: ๐@abhayprajaapati
Youtube: ๐บ@Abhayprajapati
Top comments (0)