Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type #11

Open
kokojong opened this issue Oct 25, 2022 · 0 comments
Open

Type #11

kokojong opened this issue Oct 25, 2022 · 0 comments

Comments

@kokojong
Copy link
Owner

Type Inference(타입 추론)

  • 선언과 동시에 초기화를 하게되면 컴파일러가 초기화된 값을 보고 타입을 추론해줌. float이나 character등의 자료형은 이것을 포함하는 double이나 string으로 추론되기 때문에 원하는 자료형이 아닐 수 있다.

Type Conversion(타입 변환)

  • 말 그대로 타입을 바꿔줌(Int를 Int8로 바꾼다거나 Int를 Double로 바꾼다거나)

Type Annotation

  • 직접 자료형을 명시해주는 것 let a: string 형식으로 사용되고 초기화를 하지 않아도 된다. 추가적으로 타입 추론보다 조큼 더 빠르다고한다.(추론을 안해도 되니까)

Typealias

  • string, int등의 내장된 유형 뿐 아니라 다른 유형의 타입도 사용이 가능하도록 함(strunct, class, closure등)
  • Typealias test = [Int] 처럼 사용
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant