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 173 views
1 answer 129 views
2 answers 169 views
1 answer 145 views
145 views asked Jun 11, 2023 by avibootz
1 answer 176 views
1 answer 191 views
191 views asked Apr 18, 2023 by avibootz
2 answers 213 views
...