From 459bfb7caa8c3905f1f3be4f468cd4ed7cbdea80 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 8 Jun 2020 11:19:33 -0400 Subject: [PATCH] Busted version of hello/print --- rustbyexample/hello/print.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 rustbyexample/hello/print.rs diff --git a/rustbyexample/hello/print.rs b/rustbyexample/hello/print.rs new file mode 100644 index 0000000..de38bfa --- /dev/null +++ b/rustbyexample/hello/print.rs @@ -0,0 +1,23 @@ +fn main() { + println!("{} days", 31); + + println!("{0}, this is {1}. {1}, this is {0}", "Alice", "Bob"); + + println!("{subject} {verb} {object}", + object="the lazy dog", + subject="the quick brown fox", + verb="jumps over"); + + println!("{} of {:b} people know binary, the other half doesn't", 1, 2); + + println!("{number:>width$}", number=1, width=6); + + println!("{number:>0width$}", number=1, width=6); + + println!("My name is {0}, {1} {0}", "Bond"); + + #[allow(dead_code)] + struct Structure(i32); + + println!("This struct `{}` won't print...", Structure(3)); +}