From 906fb147993b54e9408a08261539f728e1ebf534 Mon Sep 17 00:00:00 2001 From: davhojt Date: Thu, 19 May 2022 11:02:57 +0300 Subject: [PATCH] docs(groceries): correct grammar --- subjects/groceries/README.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/subjects/groceries/README.md b/subjects/groceries/README.md index f515f74b..bbc37719 100644 --- a/subjects/groceries/README.md +++ b/subjects/groceries/README.md @@ -2,16 +2,10 @@ ### Instructions -Create a **function** called `insert` that inserts a new element at the end of the `Vec`. +Create a **function** named `insert`, that inserts a new element at the end of the `Vec`. -And another **function** `at_index` that returns the value found at the index passed as an argument. +Create another **function** named `at_index` that returns the value found at the index passed as an argument. -### Notions - -- [Common Collections](https://doc.rust-lang.org/stable/book/ch08-00-common-collections.html) -- [Vectors](https://doc.rust-lang.org/stable/book/ch08-01-vectors.html) - -### Expected Functions ```rust pub fn insert(vec: &mut Vec, val: String) { @@ -31,12 +25,12 @@ use groceries::{insert, at_index}; fn main() { let mut groceries = vec![ "yogurt".to_string(), - "panetone".to_string(), + "panettone".to_string(), "bread".to_string(), "cheese".to_string(), ]; insert(&mut groceries, String::from("nuts")); - println!("The groceries list now = {:?}", &groceries); + println!("The groceries list contains {:?}", &groceries); println!( "The second element of the grocery list is {:?}", at_index(&groceries, 1) @@ -48,7 +42,12 @@ And its output: ```console $ cargo run -The groceries list now = ["yogurt", "panetone", "bread", "cheese", "nuts"] -The second element of the grocery list is "panetone" +The groceries list contains ["yogurt", "panettone", "bread", "cheese", "nuts"] +The second element of the grocery list is "panettone" $ ``` + +### Notions + +- [Common Collections](https://doc.rust-lang.org/stable/book/ch08-00-common-collections.html) +- [Vectors](https://doc.rust-lang.org/stable/book/ch08-01-vectors.html) \ No newline at end of file