...

/

Solution Review: Defining Variables

Solution Review: Defining Variables

This lesson gives a detailed solution review of the challenge in the previous lesson.

We'll cover the following...

Solution:

Press + to interact
fn test() {
// declare a mutable variable `x`
let mut x = 1000;
// declare a variable `y`
let y="Programming";
// print output of `x`
println!("x:{}", x);
// print output of `y`
println!("y:{}", y);
// update x
x = 1100;
// print output of `x`
println!("x:{}", x);
// print output of `y`
println!("y:{}", y);
}

Explanation

  • On
...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy