What you'll build
Documentation and tests for code.
What you'll learn
- How built-in types are not perfect representations of the data they represent.
- Why documentation and testing are important.
- How to test a function.
Key vocabulary
Introduction
Your code doesn't always work as you expect it to. Sometimes the fault is yours—you made a logical error while designing your algorithm, or you made a typo when writing your code. And sometimes the fault lies in the system—the way the computer represents basic data or the way an API works.
In either case, testing your code will help you detect these errors and make sure that your functions behave predictably. In this lesson, you'll discover more about the limitations of existing systems and the ways you can (and should) protect yourself against bugs.
Go Build
Open the Testing Code.playground file in your course resources and follow the instructions.

Reflection Questions
Are there other types built into Swift and the Foundation framework that have limitations?
Are there types without limitations? How might you categorize them? (The Types lesson is one place to find other built-in types.)
Why is testing important? How can testing affect the development process as your code grows bigger and more complex?
How can you write good documentation for your code? How can you apply documentation beyond just describing how your functions work?
Summary
As you tackle more complex challenges in the rest of this course, think about the ways you can document and test your code. Documentation in particular might seem like wasted effort, but it's a surefire way to minimize confusion when you revisit your code later or when you want somebody else to look at it. Without going overboard, consider how you can write comments to document top-level things like structs and functions, as well as their inner workings.
Someday you'll thank yourself for taking that extra effort to document your code—and that day might come sooner than you think.