Skip to content

Commit c6718c3

Browse files
committed
Merge branch 'main' into sean-parent/algorithms
2 parents e3d6f9d + 0d00da7 commit c6718c3

File tree

4 files changed

+1167
-3
lines changed

4 files changed

+1167
-3
lines changed

better-code/src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
- [Introduction](./chapter-1-introduction.md)
44
- [Contracts](./chapter-2-contracts.md)
5+
- [Errors](./chapter-3-errors.md)
56
- [Algorithms](./chapter-4-algorithms.md)
7+
- [Types](./chapter-4-types.md)

better-code/src/chapter-2-contracts.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ It's an invariant of your program that a manager ID can't just be
640640
random; it has to identify an employee that's in the database—that's
641641
part of what it means for the program to be in a good state, and all
642642
through the program you have code to ensure that invariant is upheld.
643+
643644
#### Encapsulating invariants
644645

645646
It would be a good idea to identify and document that whole-program
@@ -815,9 +816,9 @@ the array has an element. OK, so what about postconditions?
815816

816817
The postconditions are the effects of the method plus any returned
817818
result. If the preconditions are met, but the postconditions are not,
818-
and the function does not report an error, we'd say the method has a
819-
bug. The bug could be in the documentation of course, *which is a
820-
part of the method*.
819+
and the function does not report a runtime error, we'd say the method
820+
has a bug. The bug could be in the documentation of course, *which is
821+
a part of the method*.
821822

822823
```swift
823824
/// Removes and returns the last element.

0 commit comments

Comments
 (0)