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 161 views
1 answer 123 views
2 answers 164 views
1 answer 140 views
140 views asked Jun 11, 2023 by avibootz
1 answer 172 views
1 answer 179 views
179 views asked Apr 18, 2023 by avibootz
2 answers 204 views
...