본문 바로가기

분류 전체보기

(92)
Playgrounds '플레이그라운드' 11. '코드'gemCounter에 초기 값0을 할당합니다.보석을 발견한 경우 해당 보석을 수집하고 gemCounter 값을 1만큼 증가시킵니다.for i in 1 ... 7 {moveForward()collectGem()}if !isOnGem {gemCounter = gemCounter + 1gemCounter = gemCounter + 1gemCounter = gemCounter + 1}turnRight()for i in 1 ...2 {moveForward()collectGem()}if !isOnGem {gemCounter = gemCounter + 1}turnRight()for i in 1 ...7 {moveForward()collectGem()}if !isOnGem {gemCounter = gemCoun..
Playgrounds ‘플레이그라운드’ 10. '코드'var gemCounter = 의 초기 값을 0으로 설정합니다.var를 사용하여 변수에 이름을 지정하세요.보석을 수집 합니다.var gemCounter = 0moveForward()moveForward()collectGem()gemCounter = 1
Playgrounds '플레이그라운드' 9. '코드'논리 연산자 !(NOT) = !a a가 true이면 false, false이면. True 반환조건문if {} else {논리 연산자와 조건문을 사용하여 코드를 완성했습니다.for i in 1 ... 4 {moveForward()collectGem()}turnLeft()turnLeft()if isOnGem {turnRight()moveForward()moveForward()collectGem()} else {moveForward()}if isOnGem {turnRight()moveForward()moveForward()collectGem()} else {moveForward()}if isOnGem {turnRight()moveForward()moveForward()collectGem()} else..
Playgrounds '플레이그라운드' 8. '코드'for = 반복문 사용하여 실행할 횟수를 조정합니다.if ~ else = 조건문if isOnGem {collectGem()} elses {collectGem()사용하여 코드를 완성 합니다. for i in 1 ... 3 {moveForward()}if isOnGem {collectGem()} else {collectGem()for i in 1 ... 4 {moveForward()}if isOnGem {collectGem()}turnLeft()for i in 1 ... 2 {moveForward()}if isOnGem {collectGem()}turnLeft()for i in 1 ... 3 {moveForward()}if isOnGem {collectGem()} else {collectGem()}
Playgrounds '플레이그라운드' 7. '코드'if {} else {}moveForward()if isOnClosedSwitch {toggleSwitch()} else if isOnGem {collectGem()}moveForward()if isOnClosedSwitch {toggleSwitch()} else if isOnGem {collectGem()}
Playgrounds '플레이그라운드' 6. '코드'if 구문을 사용하여 여러 가지 조건에 대비 합니다.신호등이 초록색이면 캐릭터가 앞으로 걸어가 길을 건넙니다.for i in 1 ... 2 {moveForward()}if isOnClosedSwitch {toggleSwitch()}moveForward()if isOnClosedSwitch {toggleSwitch()}moveForward()if isOnClosedSwitch {toggleSwitch()}
Playgrounds '플레이그라운드' 5. '코드'for 반복문 사용하여 명령을 순서대로 반복해 보세요.주변에 있는 보석을 모아보세요.for i in 1 ... 4 {moveForward()collectGem()}turnRight()for i in 1 ... 4 {moveForward()collectGem()}turnRight()for i in 1 ... 4 {moveForward()collectGem()}turnRight()for i in 1 ... 4 {moveForward()collectGem()}
Playgrounds '플레이그라운드' 4. '코드'보석을 수집하는 동안 포털을 이동합니다.반복문 for i in 1 ... 3 = 숫자를 반복적으로 이동합니다.moveForward()collectGem()moveForward()collectGem()moveForward()collectGem()moveForward()collectGem()moveForward()collectGem()