컴퓨터
Swift
sayyesdoit
2020. 12. 31. 13:40
Hello, World!
print("Hello, world!")
// Prints "Hello, world!"
상수 선언
let myConstant = 42
변수 선언 및 정의
var myVariable = 42
myVariable = 50
형지정
let explicitDouble: Double = 70
형변환
let label = "The width is "
let width = 94
let widthLabel = label + String(width)
문자열에 값 포함시키기
let apples = 3
let oranges = 5
let appleSummary = "I have \(apples) apples."
let fruitSummary = "I have \(apples + oranges) pieces of fruit."
여러줄 문자열 정의
let quotation = """
I said "I have \(apples) apples."
And then I said "I have \(apples + oranges) pieces of fruit."
"""
배열과 딕셔너리