Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //use std::fmt::Debug;
- //use std::io;
- fn main() {
- /*println!("Hello, world!");
- println!("{} of {:b} people know binary, the other half doesn't", 1, 2);
- println!("{number:>width$}", number=1, width=6);
- println!("My name is {0}, {1} {0}", " Bond","james");*/
- #[derive(Debug)]
- struct Structure(i32);
- // However, custom types such as this structure require more complicated
- // handling. This will not work.
- println!("{:?}", Structure(3));
- let formatted_number = format!("{:.*}",2,1.234567);
- assert_eq!("1.23", formatted_number);
- println!("{}",formatted_number);
- let pi = 3.141592;
- let formatted_pi = format!("{:.*}",3, pi);
- println!("Pi is roughly {}", formatted_pi);
- println!("{}", format!("{:.*}",3, 3.141592));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement