How Do I Store Data to Work With?
摘要
Programs would be boring and of little use if they were not able to accept input from the user. Some data is entered directly, others are read from files or queried from a database. Even clicking a button is a form of data input. Wherever the data that a program is to process comes from, it must be stored in the computer’s memory in a way that allows the program to access it quickly. From the programmer’s point of view, this is done in the form of variables. This chapter discusses variables, their data types, conversions between them, whole fields of variables (arrays and dictionaries/hashes), and the popular idea of object-oriented programming (OOP). After this chapter you will be well prepared to handle data in your programs. In the next chapter, we will look at how data is actually read in.