Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- ios개발
- iOS프로그래밍
- DART
- Python
- 로봇프레임워크
- 테스트오토메이션
- 야곰스위프트
- 파이썬자동화
- Swift5
- dartlang
- 티스토리챌린지
- 테스트자동화
- 스위프트프로그래밍
- 다트언어
- 다트기본문법
- 테킷앱스쿨
- playwright
- qaautomation
- testautomation
- pythonautomation
- 스위프트
- 플러터
- 다트기초문법
- Flutter
- QA자동화
- 다트
- 스위프트개발
- SWIFT
- 오블완
- robotframework
Archives
- Today
- Total
day_by_day
8. Typedef 본문
1. 선언과 사용
main의 첫번째 줄에서 operation에는 add라는 함수가 들어있음
void main(){
Operation operation = add;
int result = operation(10, 20, 30);
print(result);
operation = sub;
int res2 = operation(30,20,10);
print(res2);
//아래와 같이 많이씀
int res3 = calculate(30,40,50, add);
print(res3);
}
//signature : return type과 parameter의 형태
typedef Operation = int Function(int x, int y, int z);
int add(int x, int y, int z) => x + y + z;
int sub(int x, int y, int z) => x - y - z;
int calculate(int x, int y, int z, Operation operation){
return operation(x,y,z);
}
'QA Automation > dart' 카테고리의 다른 글
10. Immutable 프로그래밍과 Getter, Setter, private keyword (2) | 2023.05.16 |
---|---|
9. class : 기본, 생성자와 this (2) | 2023.05.16 |
7. 함수(function) (2) | 2023.05.16 |
6. Map (2) | 2023.05.15 |
5. List (4) | 2023.05.15 |