@@ -392,14 +392,10 @@ By the way, in these examples, `i` indicates that the number is an integer.
392
392
393
393
Rust is a statically typed language, which means that we specify our types up
394
394
front. So why does our first example compile? Well, Rust has this thing called
395
- "[ Hindley-Milner type
396
- inference] ( http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system ) ",
397
- named after some really smart type theorists. If you clicked that link, don't
398
- be scared: what this means for you is that Rust will attempt to infer the types
399
- in your program, and it's pretty good at it. If it can infer the type, Rust
395
+ "type inference." If it can figure out what the type of something is, Rust
400
396
doesn't require you to actually type it out.
401
397
402
- We can add the type if we want to. Types come after a colon (` : ` ):
398
+ We can add the type if we want to, though . Types come after a colon (` : ` ):
403
399
404
400
``` {rust}
405
401
let x: int = 5;
@@ -1281,15 +1277,15 @@ two main looping constructs: `for` and `while`.
1281
1277
1282
1278
The ` for ` loop is used to loop a particular number of times. Rust's ` for ` loops
1283
1279
work a bit differently than in other systems languages, however. Rust's ` for `
1284
- loop doesn't look like this C ` for ` loop:
1280
+ loop doesn't look like this "C style" ` for ` loop:
1285
1281
1286
- ``` {ignore, c}
1282
+ ``` {c}
1287
1283
for (x = 0; x < 10; x++) {
1288
1284
printf( "%d\n", x );
1289
1285
}
1290
1286
```
1291
1287
1292
- It looks like this:
1288
+ Instead, it looks like this:
1293
1289
1294
1290
``` {rust}
1295
1291
for x in range(0i, 10i) {
@@ -1312,10 +1308,9 @@ valid for the loop body. Once the body is over, the next value is fetched from
1312
1308
the iterator, and we loop another time. When there are no more values, the
1313
1309
` for ` loop is over.
1314
1310
1315
- In our example, the ` range ` function is a function, provided by Rust, that
1316
- takes a start and an end position, and gives an iterator over those values. The
1317
- upper bound is exclusive, though, so our loop will print ` 0 ` through ` 9 ` , not
1318
- ` 10 ` .
1311
+ In our example, ` range ` is a function that takes a start and an end position,
1312
+ and gives an iterator over those values. The upper bound is exclusive, though,
1313
+ so our loop will print ` 0 ` through ` 9 ` , not ` 10 ` .
1319
1314
1320
1315
Rust does not have the "C style" ` for ` loop on purpose. Manually controlling
1321
1316
each element of the loop is complicated and error prone, even for experienced C
0 commit comments