Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hyperion@hyperion:~/rust_material/playground/src$ more main.rs
- extern crate rand;
- use std::io;
- use std::cmp::Ordering;
- use rand::Rng;
- fn main() {
- let a = 5;
- if a>10{
- println!("true");
- }
- else {
- println!("false");
- }
- }
- fn display_p(arr : [i32;5]) {
- let a = {
- let b : i32 = 32;
- };
- println!("{}",a)
- }
- /*
- let er : (i32,f32,char)=(23,23.0,'');
- printn;
- match a.cmp(&b)
- {
- Ordering::Less => println(),
- Ordering::Greater =>,
- }
- let a : u32 ="42".len().expect("bot a number");;
- let mut a: u32 =String.new().trim().parse();
- data types are as
- i8;i16;164
- u64,u32;
- isize depends on the architecture
- usize depends on the arch
- rust floating types are defined as
- f32 as 32 bit
- f64 as 64 bit
- let f :bool = false;
- char is the most basic and is thus used as it is
- let a = 'a';
- */
- hyperion@hyperion:~/rust_material/playground/src$ cargo run
- Compiling playground v0.1.0 (/home/hyperion/rust_material/playground)
- warning: unused import: `std::io`
- --> src/main.rs:3:5
- |
- 3 | use std::io;
- | ^^^^^^^
- |
- = note: #[warn(unused_imports)] on by default
- warning: unused import: `std::cmp::Ordering`
- --> src/main.rs:4:5
- |
- 4 | use std::cmp::Ordering;
- | ^^^^^^^^^^^^^^^^^^
- warning: unused import: `rand::Rng`
- --> src/main.rs:5:5
- |
- 5 | use rand::Rng;
- | ^^^^^^^^^
- error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> src/main.rs:22:19
- |
- 22 | println!("{}",a)
- | ^ `()` cannot be formatted with the default formatter
- |
- = help: the trait `std::fmt::Display` is not implemented for `()`
- = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
- = note: required by `std::fmt::Display::fmt`
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0277`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
Add Comment
Please, Sign In to add comment