본문 바로가기

Playgrounds'플레이그라운드'

Playgrounds '플레이그라운드' 7.

'코드'

if <조건식> {

<조건이 참일 떄 실행할 구문>

} else {

<조건이 거짓일 떄 실행할 구문>

}

moveForward()

if isOnClosedSwitch {

toggleSwitch()

} else if isOnGem {

collectGem()

}

moveForward()

if isOnClosedSwitch {

toggleSwitch()

} else if isOnGem {

collectGem()

}