Small Summary about the repository and its purpose
Go into more detail about the repository and its purpose
If a variable read from the console is an integer, then return true:
func checkIfStringContainsInteger(with string: String) -> Bool {
if let string = Int(string) {
return true
}
return false
}
if let readLine = readLine() {
print(checkIfStringContainsInteger(with: readLine))
}
But we can improve this code by extending String to get self
as the String type presented
extension String {
func checkIfStringContainsInteger() -> Bool {
if let self = Int(self) { return true }
return false
}
}
if let readLine = readLine() {
print(checkIfStringContainsInteger(with: readLine))
}
Write a small conclusion for your repository