Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 540 Bytes

File metadata and controls

31 lines (25 loc) · 540 Bytes

Strings:

  • storing texts or variables is known as string we use the keyword let in rust

  • main.rs

  • basic strings

fn main() {
    /* string */
    let company:&str = "CompanyOne";
    let location:&str = "Some where in the world";

    println!("company name: {} location: {}", company, location);
}
  • illustration
fn main() {
    /* store names inside name */
    let mut name = String::new();
    name.push_str("NameOne");
    name.push_str("NameTwo");

    println!("{}", name);
}
$ cargo run