S.Y*_*Kim 1 conventions println rust
我想要像下面这样的双重休息:
[ your title there ]
some kind of content...
Run Code Online (Sandbox Code Playgroud)
在 Rust 中,有两个宏可以打印到标准输入,一个有 like 中断,另一个没有 like 中断。以及一些可能打印的代码,如下所示:
[ your title there ]
some kind of content...
Run Code Online (Sandbox Code Playgroud)
或者
// use println! only for consistency.
println!("[ your title here ]\n"); // i find it awkward because prinln! already has some sort of '\n' in it.
println!("some kind of content...");
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法在 Rust 中打印两个或更多换行符?或者其他语言将不带 like 中断的 print 和带单个 like 中断的打印作为单独的函数,如 C#、Java、...等?
怎么样
println!("[ your title here ]");
println!();
println!("some kind of content...");
Run Code Online (Sandbox Code Playgroud)
您的代码具有与结果输出相同的布局和换行符数量,这使得换行符所在的位置一目了然。
| 归档时间: |
|
| 查看次数: |
59 次 |
| 最近记录: |