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

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.

主站蜘蛛池模板: 祁门县| 辉南县| 海宁市| 龙海市| 阜平县| 乡城县| 九江县| 宁陕县| 东乌珠穆沁旗| 永定县| 临夏市| 新乡县| 克拉玛依市| 荔浦县| 元谋县| 嘉峪关市| 长岭县| 金坛市| 杭州市| 嵊泗县| 东安县| 通城县| 翁源县| 漳浦县| 富裕县| 紫金县| 新泰市| 电白县| 宜阳县| 太谷县| 昭通市| 万年县| 临猗县| 武威市| 灵台县| 微山县| 香港 | 如皋市| 乃东县| 鸡泽县| 仁怀市|