-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda
More file actions
33 lines (27 loc) · 656 Bytes
/
lambda
File metadata and controls
33 lines (27 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Lamdas
/* a function without name
also known as anonymous function or lambda
--as we know a function in Dart is a object
int sum=2;
String message= "Hello";
Function addNumbers=// some value;
*/
void main(){
Function addTwoNumbers = (int a, int b){
var sum= ;
print(sum);
};
var multiplyByFour = (int number){
return number*4;
};
//lambda
Function addNumber= (int a, int b)=>print(a+b);
var multiplyByFour = (int number)=>number*4;
//calling lambda fuction
addTwoNumbeer(2,5);
prin( multipleByFour(5));
}
void addMyNumbers(int a, int b){
var sum= a+b;
print(sum);
}