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 310 views
1 answer 218 views
2 answers 306 views
1 answer 236 views
236 views asked Jun 11, 2023 by avibootz
1 answer 266 views
1 answer 272 views
272 views asked Apr 18, 2023 by avibootz
2 answers 353 views
...