일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 기초
- Generalizing a Funcetion
- Grammarly
- 맥
- 코린이
- 해당 비즈니스 및 사이트명을 포함할 수 있도록 페이지 텍스트를 편집하세요 - wix.com
- Playgrounds
- Polite
- Playground
- SwiftUI
- progamming
- BASIC
- 신세지다
- 컴터 연결
- obliged
- 렛츠톡 첫 화면
- collect the total
- allege
- 구글이 좋아하는 강한 SEO 작성 방법
- Uniting Worlds
- 코딩
- 인앱 결제
- coding
- Making Your Own Portals
- Learning
- Swift
- Connect and Solve
- crank up and down
- feel torn
- 2대 연결
- Today
- Total
IT
Day 8 - Initialization 본문
Initializing your Expert
let expert = Expert()
func expertMovethree() {
expert.moveForward()
expert.moveForward()
expert.moveForward()
}
func expertTurnAround() {
expert.turnLeft()
expert.turnLeft()
}
expert.moveForward()
expert.moveForward()
expert.moveForward()
expert.turnLockUp()
expertTurnAround()
expertMovethree()
expert.turnLeft()
for i in 1 ... 3 {
expertMovethree()
expert.collectGem()
expertTurnAround()
expertMovethree()
expert.turnLeft()
}
comment) I could take advantage of the 'func'
Train your expert
let expert = Expert()
func expertMoveTwo () {
expert.moveForward()
expert.moveForward()
}
func expertTurnAround() {
expert.turnLeft()
expert.turnLeft()
}
for i in 1 ... 2 {
expertMoveTwo()
expert.collectGem()
expertTurnAround()
expertMoveTwo()
expert.turnRight()
}
expertMoveTwo()
expert.collectGem()
expert.turnLockDown()
expertTurnAround()
expertMoveTwo()
expert.turnRight()
expert.moveForward()
expertMoveTwo()
expert.turnRight()
for i in 1 ... 3 {
expertMoveTwo()
expert.collectGem()
expertTurnAround()
expertMoveTwo()
expert.turnRight()
}
Using instances of different Types
let expert = Expert()
let character = Character()
expert.moveForward()
expert.turnLockUp()
character.moveForward()
character.collectGem()
character.moveForward()
character.turnRight()
character.moveForward()
character.moveForward()
expert.turnLockDown()
expert.turnLockDown()
character.moveForward()
character.collectGem()
expert.moveForward()
expert.turnLockUp()
character.moveForward()
character.collectGem()
character.moveForward()
character.turnRight()
character.moveForward()
character.moveForward()
expert.turnLockDown()
expert.turnLockDown()
character.moveForward()
character.collectGem()
It takes two
let expert = Expert()
let character = Character()
expert.turnLeft()
expert.moveForward()
expert.moveForward()
expert.moveForward()
expert.turnRight()
expert.moveForward()
expert.moveForward()
expert.turnLeft()
expert.turnLockDown()
expert.turnLockDown()
character.moveForward()
character.moveForward()
character.collectGem()
expert.turnLeft()
for i in 1 ... 2 {
expert.moveForward()
}
expert.turnLeft()
for i in 1 ... 6 {
expert.moveForward()
}
expert.turnLeft()
expert.moveForward()
expert.moveForward()
expert.turnRight()
expert.turnLockUp()
character.moveForward()
character.moveForward()
character.toggleSwitch()
Comments) I cant figure out my Coding strength get stronger or not.
I just move forward out.
'Learn to Code' 카테고리의 다른 글
Day 10 - World Building (0) | 2022.07.04 |
---|---|
Day 9 - Parameters (0) | 2022.06.06 |
day 7 - type (0) | 2022.05.15 |
day 6 - var [변수] vs let [상수] (0) | 2022.05.12 |
How-To : "이 애플 ID로 업데이트할 수 없음" 오류 메시지 대처법 (0) | 2022.05.06 |