This chapter covers
- What are files?
- Why do you need to read from and write to files?
- How do you read from and write to files?
- How do you download a file from the internet to use in an app?
- What are file management and file content management?

You’ve reached Milestone 10: reading and writing files. Learning a new computer language isn’t complete without learning to read and write files using code. Reading and writing files lets apps store data that they can access later in the app, in another session of the app, or even when the device restarts.
An example of this is a game score. In games like Temple Run, you’d like to keep the coins that you earn after a round, so if your game stores the scores in variables, you lose your scores every time you remove your app from memory or restart your device. If the score is stored in a file, however, it can be retrieved at any time. You can store many other pieces of information in files, such as user or personal information, user preferences, volume settings, and where someone left off reading an ebook or watching a movie.