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

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.

主站蜘蛛池模板: 麻阳| 星子县| 长阳| 磐石市| 修武县| 奉化市| 托克托县| 瑞安市| 普格县| 安义县| 轮台县| 长沙县| 南开区| 分宜县| 凤山县| 台中县| 进贤县| 秦安县| 东山县| 普格县| 东兰县| 佛冈县| 灵川县| 民乐县| 武鸣县| 通辽市| 合肥市| 宾阳县| 大新县| 德庆县| 张家港市| 高淳县| 崇左市| 鹿邑县| 富宁县| 句容市| 通化县| 阿勒泰市| 隆德县| 桑日县| 都江堰市|