노트나 설명을 적어둔 것으로 실행되지 않는 텍스트를 말합니다. 주석은 Swift 컴파일러(compiler)가 코드를 컴파일할 때 무시합니다.
두 개의 슬래시를 주석처리하고 싶은 줄 앞에 입력하면 한 개의 줄을 주석 처리합니다.
// This is a comment.
여러 줄을 주석 처리하고 싶을 때에는 슬래시 뒤에 별표(/*)를 입력해 시작하고 끝에 별표 다음에 슬래시(*/)를 입력해 주석을 끝냅니다.
/* This is also a comment
but is written over multiple lines. */
스위프트에서는 중복 주석처리가 가능합니다. 중복 주석처리는 여러 줄이 주석처리가 되어있어도 큰 코드 블록을 주석 처리하여 빠르고 쉽게 주석처리를 할 수 있습니다.
/* This is the start of the first multiline comment.
/*This is the second, nested multiline comment. */
This is the end of the first multiline comment. */
'Programming > swift' 카테고리의 다른 글
[Swift Basic] 부동 소수점 숫자 Floating-Point Numbers (0) | 2022.11.18 |
---|---|
[Swift Basic] 정수 Integers (0) | 2022.11.17 |
[Swift Basic] 세미콜론 Semicolons (0) | 2022.11.01 |
[Swift Basic] 상수와 변수 Constats and Variables (0) | 2022.10.27 |
[Swift Basic] 기본 Basic (0) | 2022.10.27 |