fn main() { //borrowing => It means to allowing a function or variabe to use a value without taking //ownership : type: //- immutable borrowing [read only access] //- mutable borrowing [read write access] let s = String::from("hello world"); print_strirng(&s); let mut s1 = String::from("safal, hi"); change_string(&mut s1); println!("{}", s1); //ownership => It means every value in Rust has single owner, the variable responsible for it, //When ownership changes, the previous owner can no longer use the value let owner = String::from("pantsu"); let owner1 = owner; println!("{}", owner1); } //borrowing but read only fn print_strirng(s: &String){ println!("{} borrowed", s); } fn change_string(s: &mut String){ s.push_str("!!"); }