Functions
Declare a return type, name and parameters. Arrow syntax returns one expression.
Example
int add(int a, int b) => a + b;
String greet(String name) {
return "Hello $name";
}
print(add(2, 3));
print(greet("Ada"));Exercise
Arrow body.
int f(int x) x * 2;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.