Chapter 9. A Guessing Game
One of the great things about computers is that they can make decisions and take different paths through a program based on those decisions. If computer programs did the same thing every time, then they would be pretty boring. Can you imagine playing a computer game that always did the same thing? Computers make decisions all the time. When you’re playing Minecraft, the server is constantly checking to see whether any players have died or whether their health or hunger levels are low. It’s checking to see whether a creeper is about to explode or whether a villager will accept a trade offer. All of these decisions are made using the humbly named if statement. The if statement is such a useful statement that it’s available ...
Get A Beginner’s Guide to Writing Minecraft Plugins in JavaScript 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.