Swift 기본 문법 - 조건문 if문
Language/Swift2024. 10. 14. 22:42Swift 기본 문법 - 조건문 if문

조건문, 제어문- 특정 조건에 따라서 다른 상태를 만들어 주는 문법- 코드의 실행 흐름을 관리하는 핵심적인 구성 요소 if문if 문은 주어진 조건이 true일 때 코드 블록을 실행else if문은, if문은 false이지만, 만약 else if문이 true일 경우 코드 실행else 문은 if문과 else if문에서 주어진 모든 조건이 false일 때 코드 블록을 실행// if 단독 사용.if condition { statements}// else문까지 사용.if condition { statements} else { statements}// else if문까지 사용.if condition { // 조건이 true일 때 실행됨 - 만약} else if anotherCondition { // 다른 조건이 ..

image