Last active
May 16, 2019 16:09
-
-
Save hngfu/22aff30dfcf6222b64bfe5fae5b42cf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
guard let inputedNumber = InputView.read() else { return } //값 입력받음 | |
let burgers = GodOfHamburger.hamburger(with: inputedNumber) //햄버거 신에게 해당 개수만큼 햄버거 받음 | |
print(burgers) //햄버거 출력 | |
} | |
main() | |
class InputView { | |
static func read() -> Int? { | |
let string = readLine() ?? "" | |
let numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9",] | |
guard numbers.contains(string) else { return nil } | |
return Int(string) | |
} | |
} | |
class GodOfHamburger { | |
static func hamburger(with number: Int) -> [String] { | |
return Array(repeating: "🍔", count: number) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment