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

Using the NOT operator to change the condition

Here's a little curveball to wrap your mind around: the NOT logical operator. It's written in code using an exclamation mark. This makes a true condition false, or a false condition true. Let's add a NOT operator to our statement. Line 10 should now look like this:

if ( ! willItBeRainingToday ) { 

Press Play in the editor. You will notice that the decision?1;making is now working the opposite way. Line 11 will be executed only if the willItBeRaining variable is false.

主站蜘蛛池模板: 望城县| 景东| 叙永县| 集贤县| 朝阳区| 于都县| 佛山市| 西乌珠穆沁旗| 山阴县| 县级市| 云南省| 彝良县| 上林县| 江山市| 抚远县| 浙江省| 木兰县| 定西市| 瑞昌市| 淳安县| 长沙市| 类乌齐县| 芜湖市| 黄冈市| 隆尧县| 苍山县| 江永县| 武功县| 浑源县| 通河县| 思茅市| 应城市| 花垣县| 宾阳县| 抚宁县| 玉龙| 拉孜县| 鹤峰县| 城口县| 四川省| 梅河口市|