Skip to content

Commit 3135102

Browse files
stevengjKristofferC
authored andcommitted
Document that true==1 and false==0 (#33252)
* Document that true==1 and false==0 * Update base/docs/basedocs.jl Co-Authored-By: Stefan Karpinski <[email protected]> * Update basedocs.jl * jldoctest
1 parent 6b3bb1f commit 3135102

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

base/docs/basedocs.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,24 @@ Unsigned
14321432
Bool <: Integer
14331433
14341434
Boolean type, containing the values `true` and `false`.
1435+
1436+
`Bool` is a kind of number: `false` is numerically
1437+
equal to `0` and `true` is numerically equal to `1`.
1438+
Moreover, `false` acts as a multiplicative "strong zero":
1439+
1440+
```jldoctest
1441+
julia> false == 0
1442+
true
1443+
1444+
julia> true == 1
1445+
true
1446+
1447+
julia> 0 * NaN
1448+
NaN
1449+
1450+
julia> false * NaN
1451+
0.0
1452+
```
14351453
"""
14361454
Bool
14371455

0 commit comments

Comments
 (0)