All programs consist of data and operations we perform on that data. That makes data an essential thing to understand in your coding journey!
In the “real” world, we use data every day to inform our decisions. We track data like how many eggs we have in our fridge so we know how many to buy for the next week. We look up data like how many minutes it will take to get to work so we know when to leave home.
Moreover, data comes in more forms than just numbers. Sometimes data is more about what is true and what isn’t. Consider the weather. We either say statements of truth like “it is raining” or “it is not raining” when deciding to bring an umbrella. We could represent these choices in terms of numbers (0 means no rain, 1 means rain) but that isn’t as intuitive as thinking about the rain in this “on” or “off” manner.
Having different forms of data allows us to better organize the information around us. In programming, this differentiation of data types is essential.
Consider how a program like Google Calendar might use different types of data:
- It uses numbers to represent the number of attendees in a meeting.
- It uses text to display the title of a meeting.
- It uses truth statements like “this meeting is private” to determine how new guests are invited.
In this lesson, we will learn about:
- The different types of data in Lua.
- How to check the type of our data.
- How to manipulate the data with operators.
Let’s get started!
Instructions
Can you think of any other categories of data in real life? What about in the applications you use?