Keep Track of Data with Variables

images/Variable.png

Data are facts—things like your age or the color of your bicycle. To work with these facts in Java, you hold them in variables. A variable is a holder of data. Think of it like a small box you can put things in.

In Minecraft, we use variables to keep track of things like players in the game, a player’s current health and location, and all the other data we need to know. (In fact, you’re going to add some variables to a piece of code in just a minute—a plugin that will build you a house.)

A variable is the box that holds that data. You can put a label on the box, but that’s just a label for your convenience—it ...

Get Learn to Program with Minecraft Plugins, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.