mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
add chapter [println and format]
This commit is contained in:
18
solutions/formatted-output/println.md
Normal file
18
solutions/formatted-output/println.md
Normal file
@ -0,0 +1,18 @@
|
||||
1.
|
||||
```rust
|
||||
fn main() {
|
||||
let s1 = "hello";
|
||||
/* Fill in the blank */
|
||||
let s = format!("{}, world!", s1);
|
||||
assert_eq!(s, "hello, world!");
|
||||
}
|
||||
```
|
||||
|
||||
2.
|
||||
```rust
|
||||
fn main() {
|
||||
print!("hello world, ");
|
||||
println!("I am");
|
||||
println!("Sunface!");
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user