Skip to content

Commit

Permalink
Fix inconsistencies in 3.11.1 (#12)
Browse files Browse the repository at this point in the history
* Fix inconsistencies in 3.11.1

- Change `doughnuts` to `doughnuts.count` as the former wouldn't have compiled
- Change `donuts` to `doughnuts` as the former was inconsistent
- Change the name of the second method from `eatDoughnuts(at:)` to `eatDoughnut(at:)` as the former was inconsistent and didn't make as much sense

* Update last updated date

Change the date of the last update to reflect my changes.
  • Loading branch information
Søren Mortensen authored and cezarywojcik committed Jan 16, 2017
1 parent 90c2204 commit 083775a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Make sure to read [Apple's API Design Guidelines](https://swift.org/documentatio

Specifics from these guidelines + additional remarks are mentioned below.

This guide was last updated for Swift 3.0 on December 7th, 2016.
This guide was last updated for Swift 3.0 on January 14th, 2017.

## Table Of Contents

Expand Down Expand Up @@ -814,7 +814,7 @@ In general, if a method can "fail", and the reason for the failure is not immedi
```swift
// PREFERRED
func eatDoughnut(at index: Int) {
guard index >= 0 && index < doughnuts else {
guard index >= 0 && index < doughnuts.count else {
// return early because the index is out of bounds
return
}
Expand All @@ -824,8 +824,8 @@ func eatDoughnut(at index: Int) {
}

// NOT PREFERRED
func eatDoughnuts(at index: Int) {
if index >= 0 && index < donuts.count {
func eatDoughnut(at index: Int) {
if index >= 0 && index < doughnuts.count {
let doughnut = doughnuts[index]
eat(doughnut)
}
Expand Down

0 comments on commit 083775a

Please sign in to comment.