From 3ee010d43ec21faf9e7ce5bb485dc2017ed7a681 Mon Sep 17 00:00:00 2001 From: Arjun Pathmarajan Date: Sun, 26 Mar 2017 12:13:20 -0700 Subject: [PATCH] Complete variable exercises. --- variables/variables1.rs | 2 +- variables/variables2.rs | 2 +- variables/variables3.rs | 2 +- variables/variables4.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/variables/variables1.rs b/variables/variables1.rs index e0ad5de8..4be88a30 100644 --- a/variables/variables1.rs +++ b/variables/variables1.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - x = 5; + let x = 5; println!("x has the value {}", x); } diff --git a/variables/variables2.rs b/variables/variables2.rs index ca024387..1cb25429 100644 --- a/variables/variables2.rs +++ b/variables/variables2.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x; + let x: i32 = 30; if x == 10 { println!("Ten!"); } else { diff --git a/variables/variables3.rs b/variables/variables3.rs index ec55a951..0be8cb82 100644 --- a/variables/variables3.rs +++ b/variables/variables3.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x = 3; + let mut x = 3; println!("Number {}", x); x = 5; println!("Number {}", x); diff --git a/variables/variables4.rs b/variables/variables4.rs index 3f7f937d..cce77061 100644 --- a/variables/variables4.rs +++ b/variables/variables4.rs @@ -1,7 +1,7 @@ // Make me compile! Scroll down for hints :) fn main() { - let x: i32; + let x: i32 = 37; println!("Number {}", x); }