Different Types of Functions in Dart
No arguments and no return type
With arguments and no return type
No arguments and return type
With arguments and with return type
Example
- No arguments and no return type
void myname() {
print('ohh hiiii');
}
void main() {
print('object oriented programming is fun!');
myname();
}
- With arguments and no return type
int argu() {
int a = 20;
int b = 400;
int result = a + b;
return result;
}
void main() {
int result = argu();
print('hii how many products in your company');
print(result);
}