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

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.

主站蜘蛛池模板: 绥化市| 古田县| 奉节县| 堆龙德庆县| 密山市| 建瓯市| 余干县| 怀来县| 台湾省| 浪卡子县| 汾阳市| 卓尼县| 阿克苏市| 离岛区| 贵溪市| 库伦旗| 古蔺县| 分宜县| 新闻| 钦州市| 景德镇市| 洪洞县| 遵义市| 富锦市| 年辖:市辖区| 通榆县| 德兴市| 兴安县| 杂多县| 乌鲁木齐县| 上饶市| 永兴县| 会同县| 茂名市| 共和县| 阿瓦提县| 通道| 泌阳县| 延津县| 垫江县| 大新县|