practo 0.1.0

Basic math operations
Documentation
use std::collections::HashMap;

fn main() {
    let mut person = HashMap::new();

    person.insert("Mandez", 30);
    person.insert("Otieno", 65);
    person.insert("Njenga", 45);

    println!("The age of Mandez is {}\n", person.get("Mandez").unwrap());

    if person.contains_key("Njenga") {
        println!("The person exists\n");
    } else {
        println!("Doesn't exist");
    }

    match person.get("Otieno") {
        Some(value) => println!("The values {} exist", value),
        None => println!("The value does not exist"),
    }

    for (name, age) in person {
        println!("The person {} has an age of {}", name, age);
    }

    let mut likes = HashMap::new();

    let lik = likes.entry("Nana").or_insert("apple");
    println!("{:?}", lik);
    likes.entry("Nana").or_insert("mango");
    println!("\nThe fruit which is being liked is {:?}", likes);

    let some_vec = vec![3, 2, 4, 6, 8, 6, 4, 1, 4, 6, 7, 8];
    let mut frequencies = HashMap::new();

    for i in &some_vec {
        let freq = frequencies.entry(*i).or_insert(0);
        *freq += 1;
    }

    println!("{:#?}", frequencies);
}