guard

guard

guard 구문. guard 구문은 조건이 참일 때에만 guard 구문 이후에 위치하는 코드를 실행하는 조건을 선언하는 구문이다. if 구문과 마찬가지로 조건을 확인하는 역할을 하지만 코드의 가독성을 높일 수 있다.

A guard statement declares a condition that must be true in order for the code after the guard statement to be executed. Using a guard statement for requirements improves the readability of your code, compared to doing the same check with an if statement.

관련 강좌
assert와 guard

logo landscape small

엘엘에듀
대표자 : 김하나
사업자번호 : 285-78-00497
충청북도 청주시 흥덕구 1순환로 503, 3층 311호
통신판매업 신고번호 : 제 2025-충북청주-0377 호
고객센터 : 카카오톡채널 @yagom
070-8098-4096