Return non-optional array up to the last int from integers()
This commit is contained in:
parent
00d14b6e19
commit
81198be13a
4 changed files with 5 additions and 6 deletions
|
@ -6,10 +6,9 @@ extension Scanner {
|
|||
return scanString(string) != nil
|
||||
}
|
||||
|
||||
func integers() -> [Int]? {
|
||||
func integers() -> [Int] {
|
||||
var numbers: [Int] = []
|
||||
while !isAtEnd {
|
||||
guard let num = scanInt() else { return nil }
|
||||
while let num = scanInt() {
|
||||
numbers.append(num)
|
||||
}
|
||||
return numbers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue