Blocks and Statements
We'll cover the following...
We'll cover the following...
Let’s revisit our Hello World program and build up from there:
The curly braces part is called a block. And as you’ve already seen in other examples, you’re not limited to just one println! macro call. You can have as many as you like:
Exercise Comment out all three of the println! calls and see what happens.
Let’s look at another program:
Just for kicks, I’m going to wrap the right-hand side of let x = in curly braces:
What we’ve done here is create a new block, and put the expression 4 + 5 inside of it. Blocks themselves are expressions, and ...