'코드'
if 구문을 사용하여 여러 가지 조건에 대비 합니다.
신호등이 초록색이면 캐릭터가 앞으로 걸어가 길을 건넙니다.
for i in 1 ... 2 {
moveForward()
}
if isOnClosedSwitch {
toggleSwitch()
}
moveForward()
if isOnClosedSwitch {
toggleSwitch()
}
moveForward()
if isOnClosedSwitch {
toggleSwitch()
}
'Playgrounds'플레이그라운드'' 카테고리의 다른 글
Playgrounds '플레이그라운드' 8. (0) | 2024.05.16 |
---|---|
Playgrounds '플레이그라운드' 7. (0) | 2024.05.15 |
Playgrounds '플레이그라운드' 5. (0) | 2024.05.15 |
Playgrounds '플레이그라운드' 4. (0) | 2024.05.14 |
Playgrounds ‘플레이그라운드’ 3. (0) | 2024.05.14 |