Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 499 Bytes

README.md

File metadata and controls

34 lines (28 loc) · 499 Bytes

Vectors

  • basic vectors:
fn main() {
   let mut v = Vec::new();
   v.push(20);
   v.push(30);
   v.push(40);
   v.push(500);

   for i in &v {
      println!("{}",i);
   }
   println!("{:?}",v);
}
  • advanced vectors:
use std::collections::HashSet;

fn main() {
    let mut names = HashSet::new();

    names.insert("NameOne");
    names.insert("NameTwo");
    names.insert("NameThree");

    if names.contains(&"NameOne") {
        println!("Name One Founded!");
    }
}