2016-03-12 21:32:24 -06:00
|
|
|
fn boolean() -> bool {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
2016-03-12 22:39:09 -06:00
|
|
|
fn if_false() -> i64 {
|
2016-03-17 07:39:29 -05:00
|
|
|
let c = false;
|
|
|
|
if c { 1 } else { 0 }
|
2016-03-12 21:32:24 -06:00
|
|
|
}
|
|
|
|
|
2016-03-12 22:39:09 -06:00
|
|
|
fn if_true() -> i64 {
|
2016-03-17 07:39:29 -05:00
|
|
|
let c = true;
|
|
|
|
if c { 1 } else { 0 }
|
2016-03-12 21:32:24 -06:00
|
|
|
}
|
|
|
|
|
2016-03-13 05:50:16 -05:00
|
|
|
fn match_bool() -> i16 {
|
|
|
|
let b = true;
|
|
|
|
match b {
|
|
|
|
true => 1,
|
|
|
|
_ => 0,
|
|
|
|
}
|
|
|
|
}
|
2016-04-22 03:34:14 -05:00
|
|
|
|
2016-04-22 07:38:46 -05:00
|
|
|
fn main() {
|
|
|
|
assert!(boolean());
|
|
|
|
assert_eq!(if_false(), 0);
|
|
|
|
assert_eq!(if_true(), 1);
|
|
|
|
assert_eq!(match_bool(), 1);
|
2018-08-24 12:18:21 -05:00
|
|
|
assert_eq!(true == true, true);
|
2016-04-22 07:38:46 -05:00
|
|
|
}
|