fn main() {
Println! ("{}", 1); // default usage, print display
Println! ("{: O}", 9); // octal
Println! ("{: X}", 255); // hexadecimal lowercase
Println! ("{: X}", 255); // hexadecimal uppercase
Println! ("{: P}", & 0); // pointer
Println! ("{: B}", 15); // binary
Println! ("{: e}", 10000f32); // scientific count (lowercase)
Println! ("{: e}", 10000f32); // scientific count (upper case)
Println! ("{:?}", "test"); // print debug
Println! ("{: #?}", ("test1", "test2")); // debug print with newline and indent
Println! ("{a} {B} {B}", a = (x), B = (y)); // name the parameter
}
A comment for rust appears in the above code. Rust’s comments start with / / for line comments and start with / / for block comments/*
and*/
surround.
Rust’s notes have some special usages and functions. Follow up details.
This work adoptsCC agreementReprint must indicate the author and the link of this article