diff --git a/rustbyexample/.gitignore b/rustbyexample/.gitignore index 7b8f48a..e7da779 100644 --- a/rustbyexample/.gitignore +++ b/rustbyexample/.gitignore @@ -1 +1,2 @@ /hello/hello +/hello/print diff --git a/rustbyexample/hello/print.rs b/rustbyexample/hello/print.rs index de38bfa..d81ba7a 100644 --- a/rustbyexample/hello/print.rs +++ b/rustbyexample/hello/print.rs @@ -14,10 +14,14 @@ fn main() { println!("{number:>0width$}", number=1, width=6); - println!("My name is {0}, {1} {0}", "Bond"); + println!("My name is {0}, {1} {0}", "Bond", "James"); #[allow(dead_code)] + #[derive(Debug)] struct Structure(i32); - println!("This struct `{}` won't print...", Structure(3)); + println!("This struct `{:?}` will print...", Structure(3)); + + let pi = 3.141592; + println!("Pi is roughly {:.3}", pi); }