布尔
Bool,在julia中其实是整数的一类(Bool <: Integer)
- 值只有2种,
true和false - 支持比较:
false<true
未定义
Undefined,一种特殊的类型
- 唯一值:
undefined - 与
javascript不同,未定义的东西会报错,而不是自动转化成undefined
无
Nothing,具有唯一值nothing,用于对应C中的void
缺失
Missing,与一些语言的null相似,但不完全相似
- 具有唯一值
missing,用于进行三值逻辑 - 对于大部分操作,
missing会传递 ```shell julia> missing==missing missing
julia> missing+8 missing
- `ismissing(x)`判断x是否为`missing`- `isequal`与`===`能正确判断<a name="2d977b3b"></a>### 三值逻辑允许的参数:`true`,`false`,`missing`| 表达式 | 名称 | 描述 || --- | --- | --- || x & y | 与 | 若有`false`则值为`false`<br />若均为`true`则值为`true`<br />否则值为`missing` || x | y | 或 | 若有`true`则值为`true`<br />若均为`false`则值为`false`<br />否则值为`missing` || ! x | 非 | `! true`=`false`<br />`! false`=`true`<br />`! missing`=`missing` || x && y | 短路与 | 不允许`missing`<br />若x为`false`则不会检测y || x || y | 短路或 | 不允许`missing`<br />若x为`true`则不会检测y || x ⊻ y | 异或 | 可使用`xor(x,y)`<br />若参数有`missing`则值为`missing`<br />若x,y相同则为`false`,否则为`true` |<a name="fc89cab8"></a>### 与数字的交互```shelljulia> false == 0truejulia> true == 1truejulia> 0 * NaNNaNjulia> false * NaN0.0
