![[Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators](/nhc-explorer-cover.webp)
[Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators
Data Types(자료형) : 메모리에 저장되는 데이터의 크기를 결정.
Primitive Data Types : [Interger, Floating-point, Boolean, Character, String]
Compound Data Types : [Structure, Enumeration, Class, Tuple]Memory : 0(off)과 1(on)을 저장할 수 있는 반도체.
Bit : 정보의 기본 단위. 0과 1을 사용.
Byte: 8bit. 8개의 비트가 모여 형성.
ex) 십진수(22) -> (이진수)00010110 로 저장.Operators(연산자) :
단항 연산자 : 공백을 포함시키면 안됨. (Prefix, Postfix Operator)
이항 연산자 : 둘다 가능하지만 공백을 일정하게 추가하는 것이 나음. (Infix Operator)
삼항 연산자 : 위와 동일. 우선순위는 내부 괄호를 우선으로 한다.
- Arithmetic Operators (산술 연산)
let a = 1
let b = 2
let result = a + b
let result2 = -a
let reulst3 = a - b
let c = 13.5
let d = 4.2
// let result4 = c % d << Error: 실수의 나머지 연산을 지원하지 않음.
let result4 = a.truncatingRemainder(dividing By: b)
Leave [Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators to:
Read more #swift4 posts
Best Posts From gunw
We have not curated any of gunw's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From gunw
- [Grammer] 26 - Custom Operators
- [Grammer] 25 - Operator Methods
- [Grammer] 23 - Bitwise Operators, 24 - Identity Operator
- [Grammer]21 - Ternary Coditional Operator, 22 - Range Operators
- [Grammer] 19 - Short-circuit Evaluation, Side Effect, 20 - Assignment Operators
- [Grammer] 16 - Overflow Operators, 17 - Comparison Operators, 18 - Logical Operators
- [Grammer] 13 - Data Types with Memory, 14 - Operator Basics, 15 - Arithmetic Operators
- [Grammer] 11 - Type Inference, Type Safety, 12 - Type Conversion, Type Aliases
- [Grammer] 09 - Boolean, 10 - Strings and Characters
- [Grammer] 07 - Naming Convention, 08 - Numbers