File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 12
12
//
13
13
/// The boolean type.
14
14
///
15
- /// The `bool` represents a value, which could only be either `true` or `false`.
15
+ /// The `bool` represents a value, which could only be either `true` or `false`. If you cast
16
+ /// a `bool` into an integer, `true` will be 1 and `false` will be 0.
16
17
///
17
18
/// # Basic usage
18
19
///
56
57
///
57
58
/// Also, since `bool` implements the [`Copy`](marker/trait.Copy.html) trait, we don't
58
59
/// have to worry about the move semantics (just like the integer and float primitives).
60
+ ///
61
+ /// Now an example of `bool` cast to integer type:
62
+ ///
63
+ /// ```
64
+ /// assert_eq!(true as i32, 1);
65
+ /// assert_eq!(false as i32, 0);
66
+ /// ```
59
67
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
60
68
mod prim_bool { }
61
69
You can’t perform that action at this time.
0 commit comments