@@ -150,7 +150,7 @@ in your file name, use an underscore. `hello_world.rs` versus `goodbye.rs`.
150150
151151Now that you've got your file open, type this in:
152152
153- ```
153+ ``` {rust}
154154fn main() {
155155 println!("Hello, world!");
156156}
@@ -166,7 +166,7 @@ Hello, world!
166166
167167Success! Let's go over what just happened in detail.
168168
169- ```
169+ ``` {rust}
170170fn main() {
171171
172172}
@@ -186,7 +186,7 @@ declaration, with one space in between.
186186
187187Next up is this line:
188188
189- ```
189+ ``` {rust}
190190 println!("Hello, world!");
191191```
192192
@@ -562,7 +562,7 @@ the block is executed. If it's `false`, then it is not.
562562
563563If you want something to happen in the ` false ` case, use an ` else ` :
564564
565- ```
565+ ``` {rust}
566566let x = 5i;
567567
568568if x == 5i {
@@ -574,7 +574,8 @@ if x == 5i {
574574
575575This is all pretty standard. However, you can also do this:
576576
577- ```
577+
578+ ``` {rust}
578579let x = 5i;
579580
580581let y = if x == 5i {
@@ -586,7 +587,7 @@ let y = if x == 5i {
586587
587588Which we can (and probably should) write like this:
588589
589- ```
590+ ``` {rust}
590591let x = 5i;
591592
592593let y = if x == 5i { 10i } else { 15i };
@@ -643,7 +644,7 @@ every line of Rust code you see.
643644What is this exception that makes us say 'almost?' You saw it already, in this
644645code:
645646
646- ```
647+ ``` {rust}
647648let x = 5i;
648649
649650let y: int = if x == 5i { 10i } else { 15i };
@@ -989,7 +990,7 @@ notation: `origin.x`.
989990The values in structs are immutable, like other bindings in Rust. However, you
990991can use ` mut ` to make them mutable:
991992
992- ``` rust
993+ ``` { rust}
993994struct Point {
994995 x: int,
995996 y: int,
@@ -1013,7 +1014,7 @@ called a **tuple struct**. Tuple structs do have a name, but their fields
10131014don't:
10141015
10151016
1016- ```
1017+ ``` {rust}
10171018struct Color(int, int, int);
10181019struct Point(int, int, int);
10191020```
@@ -1028,7 +1029,7 @@ let origin = Point(0, 0, 0);
10281029It is almost always better to use a struct than a tuple struct. We would write
10291030` Color ` and ` Point ` like this instead:
10301031
1031- ``` rust
1032+ ``` { rust}
10321033struct Color {
10331034 red: int,
10341035 blue: int,
@@ -1049,7 +1050,7 @@ There _is_ one case when a tuple struct is very useful, though, and that's a
10491050tuple struct with only one element. We call this a 'newtype,' because it lets
10501051you create a new type that's a synonym for another one:
10511052
1052- ```
1053+ ``` {rust}
10531054struct Inches(int);
10541055
10551056let length = Inches(10);
@@ -1166,7 +1167,7 @@ what's the solution?
11661167Rust has a keyword, ` match ` , that allows you to replace complicated ` if ` /` else `
11671168groupings with something more powerful. Check it out:
11681169
1169- ``` rust
1170+ ``` { rust}
11701171let x = 5i;
11711172
11721173match x {
@@ -1407,7 +1408,7 @@ We now loop forever with `loop`, and use `break` to break out early.
14071408` continue ` is similar, but instead of ending the loop, goes to the next
14081409iteration: This will only print the odd numbers:
14091410
1410- ```
1411+ ``` {rust}
14111412for x in range(0i, 10i) {
14121413 if x % 2 == 0 { continue; }
14131414
@@ -4122,7 +4123,7 @@ the ability to use this **method call syntax** via the `impl` keyword.
41224123
41234124Here's how it works:
41244125
4125- ```
4126+ ``` {rust}
41264127struct Circle {
41274128 x: f64,
41284129 y: f64,
@@ -4161,7 +4162,7 @@ multiplications later, and we have our area.
41614162You can also define methods that do not take a ` self ` parameter. Here's a
41624163pattern that's very common in Rust code:
41634164
4164- ```
4165+ ``` {rust}
41654166struct Circle {
41664167 x: f64,
41674168 y: f64,
0 commit comments