상세 컨텐츠

본문 제목

[Swift] 제어 흐름

Mobile

by Yoonsang's Log 2022. 1. 1. 17:46

본문

for-in, switch, while, if, tuple, ... 등

대부분의 문법이 익숙하다.

앞부분은 가볍게 읽고 넘어가면 될 듯하다.

 

조기 종료 (Early Exit)

guard 문은 if 문과 다르게 else를 반드시 포함해야 한다.

else 문에는 return , break, continue와 같은 반환하지 않는 함수나 메소드를 호출할 수 있다.

 

 

[자료 출처]

https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html

 

Control Flow — The Swift Programming Language (Swift 5.5)

Control Flow Swift provides a variety of control flow statements. These include while loops to perform a task multiple times; if, guard, and switch statements to execute different branches of code based on certain conditions; and statements such as break a

docs.swift.org

 

'Mobile' 카테고리의 다른 글

[Swift] 함수  (0) 2022.01.01
[Swift] 컬렉션 유형  (0) 2022.01.01
[Swift] 문자 및 문자열  (0) 2022.01.01
[Swift] 기본 연산자  (0) 2022.01.01
[Swift] 첫 시작과 계기, 기초  (0) 2022.01.01

관련글 더보기

댓글 영역