- Android Development with Kotlin
- Marcin Moskala Igor Wojda
- 118字
- 2021-07-02 18:48:36
The Boolean type
Boolean is a logic type that has two possible values: true and false. We can also use the nullable Boolean type:
val isGrowing: Boolean = true val isGrowing: Boolean? = null
The Boolean type also supports standard built-in operations that are generally available in most modern programming languages:
- ||: Logical OR. Returns true when any of two predicates return true.
- &&: Logical AND. Returns true when both predicates return true.
- !: Negation operator. Returns true for false, and false for true.
Keep in mind that we can only use a not-null Boolean for any type of condition.
Like in Java, in || and && predicates are evaluated lazily, and only when needed (lazy conjunction).
推薦閱讀
- Python 3.7網(wǎng)絡(luò)爬蟲(chóng)快速入門
- Computer Vision for the Web
- Visual C++串口通信開(kāi)發(fā)入門與編程實(shí)踐
- 零基礎(chǔ)玩轉(zhuǎn)區(qū)塊鏈
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Apache Karaf Cookbook
- Java程序設(shè)計(jì)與實(shí)踐教程(第2版)
- Python數(shù)據(jù)可視化之Matplotlib與Pyecharts實(shí)戰(zhàn)
- 深入分布式緩存:從原理到實(shí)踐
- 微信小程序開(kāi)發(fā)與實(shí)戰(zhàn)(微課版)
- LabVIEW虛擬儀器入門與測(cè)控應(yīng)用100例
- ExtJS Web應(yīng)用程序開(kāi)發(fā)指南第2版
- Vue.js 3應(yīng)用開(kāi)發(fā)與核心源碼解析
- LabVIEW入門與實(shí)戰(zhàn)開(kāi)發(fā)100例(第4版)
- 計(jì)算機(jī)程序的構(gòu)造和解釋(JavaScript版)