How to create a function in Dart

2 Answers

0 votes
void f() {
    print("function");
}
 
void main(){
    f();
}
 
 
 
 
/*
run:
 
function
 
*/

 



answered Oct 8, 2022 by avibootz
edited Oct 8, 2022 by avibootz
0 votes
int sum(x, y) {
    return x + y;
}
 
void main() {
    print(sum(4, 9)); 
}
 
 
 
 
/*
run:
 
13
 
*/

 



answered Oct 8, 2022 by avibootz
edited Oct 8, 2022 by avibootz

Related questions

2 answers 315 views
1 answer 222 views
2 answers 311 views
1 answer 239 views
239 views asked Jun 11, 2023 by avibootz
1 answer 270 views
1 answer 275 views
275 views asked Apr 18, 2023 by avibootz
2 answers 357 views
...