官术网_书友最值得收藏!

Variables and arrays

There are many different types of variables. Choosing which one we want to use depends on what we want to do with it. Knowing whether it's raining or not (true/false) is different from say, knowing a character's name ("Big McLargeHuge"). Let's take a look at some of the variables we can use and what they're used for.

Booleans

Quick, is it raining? Boolean variables, or bool for short, are your basic true/false questions. They're used for everything from asking if the player is driving a vehicle, to if the game has started, to whether or not an object can collide with anything.

It's standard for boolean variables' names to start with a lower case "b". This isn't required, but it's good to follow the guidelines to keep code consistent and easily readable.

Let's take a look at how we can use booleans in our code by adding to our AwesomeActor class.

主站蜘蛛池模板: 句容市| 高陵县| 兴城市| 依兰县| 香格里拉县| 苍梧县| 日喀则市| 浪卡子县| 镇原县| 都安| 齐齐哈尔市| 隆回县| 隆回县| 上虞市| 江西省| 邵阳市| 武义县| 博乐市| 凤翔县| 华容县| 桦南县| 桃园县| 夏津县| 岢岚县| 榕江县| 临西县| 邛崃市| 辽宁省| 岐山县| 嘉定区| 永兴县| 敦煌市| 寻乌县| 内丘县| 绥化市| 宿松县| 建水县| 临澧县| 酒泉市| 民乐县| 故城县|