From e056ca9f79fb454432e1346899b5b6f933dbdb7e Mon Sep 17 00:00:00 2001 From: Tanish-Eagle Date: Sat, 2 Apr 2022 23:03:39 +0530 Subject: [PATCH 1/5] Fixed spelling mistakes and typos in the variable lesson --- en/src/variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/en/src/variables.md b/en/src/variables.md index 43ad6c5..c1c9867 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -1,6 +1,6 @@ # Variables -### Binding and mutablity +### Binding and mutability 1. 🌟 A variable can be used only if it has been initialized. ```rust,editable @@ -98,7 +98,7 @@ fn main() { } ``` -### Unused varibles +### Unused variables 1. fix the warning below with : - 🌟 only one solution @@ -135,7 +135,7 @@ fn main() { ``` ### Destructuring assignments -Introducing in Rust 1.59: You can now use tuple, slice, and struct patterns as the left-hand side of an assignment. +Introduced in Rust 1.59: You can now use tuple, slice, and struct patterns as the left-hand side of an assignment. 9. 🌟🌟 From 51734d1a4422e42c2e6741743edd71667d99837a Mon Sep 17 00:00:00 2001 From: Tanish-Eagle Date: Sat, 2 Apr 2022 23:19:14 +0530 Subject: [PATCH 2/5] Made the comments clearer --- en/src/variables.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/en/src/variables.md b/en/src/variables.md index c1c9867..0bcead9 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -4,10 +4,10 @@ 1. 🌟 A variable can be used only if it has been initialized. ```rust,editable -// fix the error below with least modifying +// Fix the error below with least amount of modification to the code fn main() { - let x: i32; // uninitialized but using, ERROR ! - let y: i32; // uninitialized but also unusing, only warning + let x: i32; // Uninitialized but used, will result in an ERROR ! + let y: i32; // Uninitialized but also unused, will only receive a warning assert_eq!(x, 5); println!("Success!") @@ -17,7 +17,7 @@ fn main() { 2. 🌟 Use `mut` to mark a variable as mutable. ```rust,editable -// fill the blanks in code to make it compile +// Fill the blanks in the code to make it compile fn main() { let __ = 1; __ += 2; @@ -33,7 +33,7 @@ A scope is the range within the program for which the item is valid. 3. 🌟 ```rust,editable -// fix the error below with least modifying +// Fix the error below with least amount of modification fn main() { let x: i32 = 10; { @@ -47,7 +47,7 @@ fn main() { 4. 🌟🌟 ```rust,editable -// fix the error with using of define_x +// Fix the error with the use of define_x fn main() { println!("{}, world", x); } @@ -63,7 +63,7 @@ You can declare a new variable with the same name as a previous variable, here w 5. 🌟🌟 ```rust,editable -// only modify `assert_eq!` to make the `println!` work(print `42` in terminal) +// Only modify `assert_eq!` to make the `println!` work(print `42` in terminal) fn main() { let x: i32 = 5; { @@ -81,17 +81,17 @@ fn main() { 6. 🌟🌟 ```rust,editable -// remove a line in code to make it compile +// Remove a line in the code to make it compile fn main() { let mut x: i32 = 1; x = 7; - // shadowing and re-binding + // Shadowing and re-binding let x = x; x += 3; let y = 4; - // shadowing + // Shadowing let y = "I can also be bound to text!"; println!("Success!") @@ -99,10 +99,10 @@ fn main() { ``` ### Unused variables -1. fix the warning below with : +1. Fix the warning below with : -- 🌟 only one solution -- 🌟🌟 two distinct solutions +- 🌟 Only one solution +- 🌟🌟 Two distinct solutions > Note: none of the solutions is to remove the line `let x = 1` @@ -112,7 +112,7 @@ fn main() { let x = 1; } -// warning: unused variable: `x` +// Warning: unused variable: `x` ``` ### Destructuring @@ -122,7 +122,7 @@ fn main() { ```rust,editable -// fix the error below with least modifying +// Fix the error below with least amount of modification fn main() { let (x, y) = (1, 2); x += 2; @@ -147,7 +147,7 @@ fn main() { let (x, y); (x,..) = (3, 4); [.., y] = [1, 2]; - // fill the blank to make the code work + // Fill the blank to make the code work assert_eq!([x,y], __); println!("Success!") From 2416688f4f38b3c24f562b2ad99078c66d652479 Mon Sep 17 00:00:00 2001 From: Tanish-Eagle Date: Sat, 2 Apr 2022 23:29:51 +0530 Subject: [PATCH 3/5] Fixed the missing semicolon --- en/src/variables.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/en/src/variables.md b/en/src/variables.md index 0bcead9..eea9bac 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -10,7 +10,7 @@ fn main() { let y: i32; // Uninitialized but also unused, will only receive a warning assert_eq!(x, 5); - println!("Success!") + println!("Success!"); } ``` @@ -23,7 +23,7 @@ fn main() { __ += 2; assert_eq!(x, 3); - println!("Success!") + println!("Success!"); } ``` @@ -94,7 +94,7 @@ fn main() { // Shadowing let y = "I can also be bound to text!"; - println!("Success!") + println!("Success!"); } ``` @@ -130,7 +130,7 @@ fn main() { assert_eq!(x, 3); assert_eq!(y, 2); - println!("Success!") + println!("Success!"); } ``` @@ -150,7 +150,7 @@ fn main() { // Fill the blank to make the code work assert_eq!([x,y], __); - println!("Success!") + println!("Success!"); } ``` From 722bb85ca6216eda01e25e5e3d34af51420efabc Mon Sep 17 00:00:00 2001 From: Tanish-Eagle Date: Sun, 3 Apr 2022 21:52:32 +0530 Subject: [PATCH 4/5] Further simplified the comments --- en/src/variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/src/variables.md b/en/src/variables.md index eea9bac..36a65e6 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -6,8 +6,8 @@ // Fix the error below with least amount of modification to the code fn main() { - let x: i32; // Uninitialized but used, will result in an ERROR ! - let y: i32; // Uninitialized but also unused, will only receive a warning + let x: i32; // Uninitialized but used, ERROR ! + let y: i32; // Uninitialized but also unused, only a warning assert_eq!(x, 5); println!("Success!"); From b7f7755014da627cc49d7713a295a48d55902550 Mon Sep 17 00:00:00 2001 From: Sunface Date: Mon, 4 Apr 2022 10:40:01 +0800 Subject: [PATCH 5/5] Update en/src/variables.md --- en/src/variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/src/variables.md b/en/src/variables.md index 36a65e6..6e70f14 100644 --- a/en/src/variables.md +++ b/en/src/variables.md @@ -7,7 +7,7 @@ // Fix the error below with least amount of modification to the code fn main() { let x: i32; // Uninitialized but used, ERROR ! - let y: i32; // Uninitialized but also unused, only a warning + let y: i32; // Uninitialized but also unused, only a Warning ! assert_eq!(x, 5); println!("Success!");