Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Round1] Step2 - Reimos7 #1003

Open
wants to merge 3 commits into
base: ss_20_Reimos7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CodeStarterCamp_Week1.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
34811DAF274B938F00A1E994 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34811DAE274B938F00A1E994 /* main.swift */; };
6E107D412CA00935004475F6 /* step3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E107D402CA00932004475F6 /* step3.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -25,6 +26,7 @@
/* Begin PBXFileReference section */
34811DAB274B938F00A1E994 /* CodeStarterCamp_Week1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CodeStarterCamp_Week1; sourceTree = BUILT_PRODUCTS_DIR; };
34811DAE274B938F00A1E994 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
6E107D402CA00932004475F6 /* step3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = step3.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -57,6 +59,7 @@
34811DAD274B938F00A1E994 /* CodeStarterCamp_Week1 */ = {
isa = PBXGroup;
children = (
6E107D402CA00932004475F6 /* step3.swift */,
34811DAE274B938F00A1E994 /* main.swift */,
);
path = CodeStarterCamp_Week1;
Expand Down Expand Up @@ -119,6 +122,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6E107D412CA00935004475F6 /* step3.swift in Sources */,
34811DAF274B938F00A1E994 /* main.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
22 changes: 21 additions & 1 deletion CodeStarterCamp_Week1/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,25 @@

import Foundation

print("Hello, World!")
var empty = " "

func iceCream(size: Int){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API 디자인 가이드라인에 함수의 네이밍 앞쪽에는 동사로 표현해주라고 권장하고 있습니다!
학습 기간 중에 꼭 디자인 가이드라인의 네이밍 부분을 정독해보시길 추천드려요 💪
예를 들어 makeIceCreamBody, printIceCreamBody와 같이요.

아래에 스틱을 그릴때는 iceCreamStick이라고 명시되어있는데 이 곳에는 몸통을 표현하고 있지 않아 그 부분도 명확하게 해주면 좋습니다 :)

  • 중괄호 앞쪽에 띄어쓰기가 되어있지 않아요!
    스위프트의 모든 중괄호는 앞쪽에 띄어쓰기가 됩니다! (아래 함수도 참고해주세요)

for _ in 1...size {
for _ in 1...10 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1...10은 무엇을 의미하나요?

print("*", terminator: "")
}
print("")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 print는 개행을 위해 호출한 건가요~?
\n 을 통해서도 개행이 가능하답니다!
함수의 호출 또한 메모리를 잡아먹는 요소가 될 수 있기에 최소화하는게 좋아요!

}
}

func iceCreamStick(size: Int){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 함수의 네이밍도 위에 코멘트를 참고하여 수정해보면 좋을 것 같아요 :)

for _ in 1...size {
print("\(empty) | | ")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty 변수를 넣은 이유가 궁금합니다!

  • 막대기 뒤의 공백은 없어도 될 것 같아요!

}
print("")
}

iceCream(size: 8)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사이즈가 높이를 의미하는지 너비를 의미하는지 모호합니다!

iceCreamStick(size: 4)

makePepero(bodylength: 10, bodyStyle: "*", topping: "$", stickLength: 4)
49 changes: 49 additions & 0 deletions CodeStarterCamp_Week1/step3.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Untitled.swift
// CodeStarterCamp_Week1
//
// Created by Reimos on 9/22/24.
//

import Foundation



func makePepero(bodylength: Int, bodyStyle: String, topping: String, stickLength: Int){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수 안애 또 함수를 구현한 이유가 궁금합니다 🤔(중괄호 띄어쓰기 해주세용!)


print("<정보>")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명은 makePepero인데 정보를 출력하는 기능도 포함되어있네요!
해당 부분도 따로 기능 분리를 해볼 수 있을까요?

print("길이:" ,bodylength)
print("몸통: \(bodyStyle)")
print("토핑: \(topping)")
print("막대길이: \(stickLength)")
print("")


func bodyLength(_ bodylength: Int){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명과 매개변수 명이 겹치고 있군요!
위 코멘트를 참고하여 함수명을 수정해보면 좋을 것 같아요 :)

for _ in 1...bodylength {
for _ in 1...3{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바깥 for문과 띄어쓰기 컨벤션이 다릅니다!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1...3은 무엇을 의미하나요?

print("\(bodyStyle)", terminator: "")
}
print("")
}
}

func toppingSet(_ topping: String){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 함수는 어떤 기능을 하나요?


}

func stick(_ stickLength: Int){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 함수도 위 코멘트를 참고하여 수정해주세요! 💪

for _ in 1...stickLength {
print("| |")
}
print("")
}

bodyLength(bodylength)
stick(stickLength)

}