Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
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
Archives
Today
Total
관리 메뉴

브래의 슬기로운 코딩 생활

iOS프로그래밍 기초 3주차 정리 본문

1-2/iOS프로그래밍 기초

iOS프로그래밍 기초 3주차 정리

김브래 2022. 9. 19. 18:10

이번 시간에는 Swift문법의 작은 부분만 배웠다.

일단 자료형이 Bool, Character, Int, Float, Double, String,Void 가 있고

변수를 선언하면 앞에 var, 상수는 let을 쓴다.

그리고 자료형은 무조건 맨 앞글자는 대문자로 쓴다.

 

-------------------------------------------------------------------------------

과제

 

Swift 문법의 주요 용어들

Simple Values

Control Flow

Functions and Closures

Objects and Classes

Enumerations and Structures

Concurrency

Protocols and Extensions

Error Handling

Generics

 

 

수업시간에 실습한 코드들

 

var x : Int = 15

print(x)

x = 80

print(x)

//15

//80

 

var x = 10

print(type(of:x)) //Int

let s = MemoryLayout.size(ofValue: x) //8

let t = MemoryLayout<Int>.size

print(s, t)

//Int

//8 8

 

var x = 10

print("x의 값은\(x)")

//x의 값은10

 

맥 환경에서 Swift 문법을 공부하는 법:

Xcode를 실행해서 File에서 New, playground 선택