Function Types

 /// Types of Functions

/// 1)  No argument and No return Type
/// 2) With argument and No return Type
/// 3) No argument and With return Type
/// 4) With argument and With return Type

/// 1) No argument and No return Type
void main() {
add();
}
void add() {
var a=10, b=20;
print(a+b);
}

/// 2) With argument and No return Type
// void main() {
// add(5,10); //Here, Two Arguments are passed
// }
// void add(var a, var b) //Here, Two parameters are defined
// {
// print(a + b);
// }

/// 3) No argument and With return Type
// void main() {
// print(add());
// }
// int add() {
// var a=2, b=4;
// var c = a + b;
// return c;
// }

/// 4) With argument and With return Type
// void main() {
// print(add(10, 50));
// }
// int add(var a, var b) {
// var c = a + b;
// return c;
// }

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