Apple-CS-interview / iOS-CS-interview

7 stars 0 forks source link

Swift에서 타입 안전성(type safety)은 어떤 방식으로 보장되나요? #36

Open Do-hyun-Kim opened 10 months ago

Do-hyun-Kim commented 10 months ago

Swift에서 타입 안전성(type safety)은 어떤 방식으로 보장되나요?

type safety

type Safety
var intNum: Int = 12
var doubleNum: Double = 12.5

intNum > doubleNum    // Error!!

intNum = 12.5         // Error!!

type Inference

var name = "Jenny"
var age = 26
var phone = "iPhone 13"

type Annotation

type Annotation
var year: Int
var day: Int
var name: String
vichye-1 commented 10 months ago

타입 세이프티(타입 안전성)란?

Swift는 type safe 언어이다.