summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-10-12 23:16:24 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-10-12 23:16:24 -0500
commitf3b1fb73efb3c92e5074c1ea7a88b1ed4b765cd4 (patch)
treea548e150c49c50bbe14e5a409867f497d27c602e
parentbe21d6a8480c429ab8d91d0aed9e74f703ea59c0 (diff)
parent2b8fe51af6d03cbae2f5139b368006c80c9ff544 (diff)
Merge pull request #1463 from thePsguy/patch-1
Mention meaning of asterisk. Explain *ref_var2
-rw-r--r--rust.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/rust.html.markdown b/rust.html.markdown
index b2854b0c..d0c56b4a 100644
--- a/rust.html.markdown
+++ b/rust.html.markdown
@@ -287,9 +287,9 @@ fn main() {
// While a value is mutably borrowed, it cannot be accessed at all.
let mut var2 = 4;
let ref_var2: &mut i32 = &mut var2;
- *ref_var2 += 2;
+ *ref_var2 += 2; // '*' is used to point to the mutably borrowed var2
- println!("{}", *ref_var2); // 6
+ println!("{}", *ref_var2); // 6 , //var2 would not compile. //ref_var2 is of type &mut i32, so //stores a reference to an i32 not the value.
// var2 = 2; // this would not compile because `var2` is borrowed
}
```