Warm tip: This article is reproduced from serverfault.com, please click

其他-锈中布尔的印刷价值

(其他 - Print Value of Bool in Rust)

发布于 2020-11-29 04:21:22

如何在Rust中打印布尔值?

let mut myFalseBool = false;
let mut myTrueBool = true; 
//how do I print out the value of either bool?
Questioner
ANimator120
Viewed
12
dpbriggs 2020-11-29 12:41:42

用相同的方式打印任何值:

let foobar = true;
println!("{}", foobar);
dbg!(foobar);

输出:

true
[src/main.rs:4] foobar = true