At this point you have learned about the core data structures of Rust. You have also seen some of the algorithms that use them. This post presents a case study with exercises. I want to let you think about choosing data structures and practice using them.
This post presents one more built-in type, the tuple. I then show how vectors, hashmaps, and tuples work together.
A HashMap contains a collection of indices, which we call keys, and a collection of values. Each key is associated with a single value. The association of a key and a value is called a key-value pair or sometimes an item.
Like a string, a Vec or std::vec is a sequence of values. In a string, the values are characters. In a vector, they can be any type, as long as they are all the same type.
This post presents a case study. It involves solving word puzzles by searching for words that have certain properties. For example, we will find the longest palindromes in English. We will also search for words whose letters appear in alphabetical order. And I will present another program development plan. A method I call "reduction to a previously solved problem".
Strings are not like integers, floats, and booleans. A string is a sequence, which means it is an ordered collection of other values. In this post you will see how to access the characters (graphemes) that make up a string. You will also learn about some of the methods strings provide.
This post is about iteration, which is the ability to run a block of statements over and over again. We saw a kind of iteration, using recursion, in part five, Conditionals and Recursion. We saw another kind, using a loop, in part four, Turtles all the way down. In this post we’ll see yet another kind.
Many of the functions we have used, produce return values. But the functions we’ve written all seem to be void. They have an effect, like printing a value or moving a turtle, but they don’t seem to have a return value. In this post you will learn to write functions that have explicit return values. And what those that seem to to not return anything actually do return.
The main topic of this post is the `if` statement. You can use it to execute different code depending on the state of the program. I also introduce the modulus operator.
This post demonstrates a process for designing functions that work together. It also introduces the `turtle` crate.
A function is a named sequence of statements that performs a computation. To define a function, you specify the name and the sequence of statements. Later, you can “call” the function by name.
Manipulating variables is one of the most powerful features of a programming language.
How do you start learning to program, and why should you choose Rust as your first language?