Logical operators
두개의 항을 비교하여 true or false를 리턴
==
!=
>
>=
<
<=
boolean operators
&&
||
!
if statements
if else statements
Boolean values
변수나 상수명 앞에 is를 붙이는게 흔하다. let isSmallNumber = number < 10
NOT
!
AND
&&
OR
||
switch statement
값이 일치하는 case의 코드 실행 후 switch 블럭을 빠져나옴
if중첩을 피할 수 있어서 코드 가독성이 좋아진다.
Int.min 으로 range 케이스 작성 시 값의 타입이 Int일 경우 그 최소값을 표현할 수 있다.
ternary operator
Question ? Answer1 : Answer2
Condition ? True statement : False statement
'[도서] App development with Swift' 카테고리의 다른 글
Unit 4 - Lesson 8: System View Controllers (0) | 2021.11.06 |
---|---|
Unit 4 - Lesson 5: Table Views (0) | 2021.10.25 |
Unit 1 - Lesson 3: Operators (0) | 2021.10.21 |
Unit 1 - Lesson 2: Constants, Variables, and Data Types (0) | 2021.10.21 |
Unit 1 - Lesson 1: Introduction to Swift and Playgrounds (0) | 2021.10.21 |