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.