We have some extra information here. We aren't supposed to change line 7, but we are somehow expected how to make things work. If we look at the error message above, we can see that we have set the number variable to a string and then we are attempting to
Alright, so we gotta talk about mutability. Mutability refers to the ability of an object's value to be changed after it's creation. If you can change it, it's considered mutable. If you cannot alter it after its creation, it is considered immutable. So, by default, when we use variables and
Possibly-uninitialized? But we did. We DID. We didn't. We declared a type, but we didn't give it a value. It's like the sound of one hand clapping. We can't use it. Lucky Number Seven.
With this file, we're starting to look at data types. It's not happy with line 7, where we tell it that we are going to be using a variable, x. It says, consider giving x a type, but let's be honest, when it says consider, it really means you have
Let's start on variables1.rs. When we look at the errors it's not quite intuitive, coming from Ruby. My initial reaction is that when we look at line 8, what do you mean not found in this scope? We're just making a new variable x, and setting five into it.
We're going to presume that you're in your rustlings directory and you've typed in rustlings watch to get thing started. When we are using rustlings watch we have started a program that will continually look at the directory in order and tell you what to do and what's going on.
Learn to set up Rustlings
Last time, we talked about static and dynamic typing, and the differences between the two. To start off, I do have some bad news to share with you. There is no specific definition of what is strongly typed and what is weakly typed. It's more of a range. A spectrum.
Today we're talking about the difference between static and dynamic typing in our programming languages. Ruby is a dynamically typed language, and Rust is a statically typed language. This all revolves around how we handle data types in our code. We know that generally, different kinds of data in computing
Hopefully, at this point, you've got Rust installed and you're good to go. If you haven't, just pop on over here. We want to start things off by having you get to know your way around Cargo. Cargo is Rust's build system and package manager. Now, there's no real Ruby