User Tools

Site Tools


devlogs:15_5_2022

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devlogs:15_5_2022 [2022/05/15 17:41]
root
devlogs:15_5_2022 [2023/10/19 15:25] (current)
Line 47: Line 47:
 </code> </code>
  
 +==== HashMap ====
 +
 +Like dictionaries these use key value pairs. 
 +
 +To make one
 +<code rust>
 +let mut name_and_age = HashMap::new();
 +
 +name_and_age.insert("Gassica",22);
 +name_and_age.insert("Alex",12);
 +
 +name_and_age.get("Alex") //ACCESSING THE VALUE
 +</code>
 +
 +You can also insert "entry"
 +
 +<code rust>
 +name_and_age.entry(String::from("thomas")).or_insert(20); //Insert only if unique
 +</code>
 +
 +which is bascially insert if unique. The aims to finish this by may atleast. (given I spend only a little time a week on it) will prollly do some exercizes thru the week without typing my noon-sense.((but typing this is fun fun fun fun)).
 +
 +{{:devlogs:rustlings_excersizes.png?direct&400|}}
  
  
devlogs/15_5_2022.1652654504.txt.gz ยท Last modified: 2023/10/13 16:43 (external edit)