⚡ use - defined to import some or all enum defined and used them directly.
⚡ const - keyword that allowed you to define an unchangeable value.
main.rs
#[derive(Debug)]
enum Rustlearning{
HOME,
STUDENT,
}
fn main(){
use crate::Rustlearning::*;
let status = HOME;
println!("{:#?}", status);
}
Example of const
constant.rs
static YEAR: i32 = 2022;
const WELCOME: &str = "Welcoming Year";
fn main(){
println!("Happy New Year {}", YEAR);
println!("{} {}", WELCOME, YEAR);
}
Github: https://github.com/eshaikhahmed/rust_learnings