swifter taipei 聊聊 swift 遊樂場、變數常數、數字與運算
Post on 22-Jan-2018
594 Views
Preview:
TRANSCRIPT
Chapter 1: Playground Basics Chapter 2: Variables and Constants Chapter 3: Numeric Types and Operations Chapter 4: Strings Chapter 5: Making Decisions Chapter 6: Repeating Steps Chapter 7: Functions Chapter 8: Optionals Chapter 9: Arrays Chapter 10: Dictionaries Chapter 11: Sets Chapter 12: Structures Chapter 13: Class Basics Chapter 14: Advanced Classes Chapter 15: Enumerations Chapter 16: Properties Chapter 17: Methods Chapter 18: Protocols Chapter 19: Protocol-oriented Programming Chapter 20: Error Handling Chapter 21: Advanced Error Handling Chapter 22: Generics Chapter 23: Functional Programming
Chapter 1: Playground Basics Chapter 2: Variables and Constants Chapter 3: Numeric Types and Operations
Chapter 1: Playground Basics Chapter 2: Variables and Constants Chapter 3: Numeric Types and Operations Chapter 4: Strings Chapter 5: Making Decisions Chapter 6: Repeating Steps Chapter 7: Functions Chapter 8: Optionals Chapter 9: Arrays Chapter 10: Dictionaries Chapter 11: Sets Chapter 12: Structures Chapter 13: Class Basics Chapter 14: Advanced Classes Chapter 15: Enumerations Chapter 16: Properties Chapter 17: Methods Chapter 18: Protocols Chapter 19: Protocol-oriented Programming Chapter 20: Error Handling Chapter 21: Advanced Error Handling Chapter 22: Generics Chapter 23: Functional Programming
Chapter 1: Playground Basics Chapter 2: Variables and Constants Chapter 3: Numeric Types and Operations
ch1
8 4 2 1
bit bit bit bitbit bit bit bit
163264128
每 8 個 bit,我們稱為 1 個 byte
所以 1 個 byte 可以記到 255 這個數字
ch1
bit bit bit bitbit bit bit bit
bit bit bit bitbit bit bit bit
bit bit bit bitbit bit bit bit
bit bit bit bitbit bit bit bit
寫這麼多 0 跟 1 是很繁瑣的,所以我們更常⽤ 16 進位表⽰
ch1
c 0 d e
1162564096
Decimal: 4096 × 12 + 256 × 0 + 13 × 16 + 1 × 14 = 43974
ch3
let doesOneEqualTwo = (1==2)let doesOneNotEqualTwo = (1!=2)let doesOneGreaterThanTwo = (1>2)let doesOneLessThanTwo = (1<2)
ch3
let andTrue = true && truelet andFalse = true && false
let orTrue = true || falselet orFalse = false || false
top related