Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc fix rollup #17277

Merged
merged 4 commits into from
Sep 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions src/doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,10 @@ By the way, in these examples, `i` indicates that the number is an integer.

Rust is a statically typed language, which means that we specify our types up
front. So why does our first example compile? Well, Rust has this thing called
"[Hindley-Milner type
inference](http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system)",
named after some really smart type theorists. If you clicked that link, don't
be scared: what this means for you is that Rust will attempt to infer the types
in your program, and it's pretty good at it. If it can infer the type, Rust
"type inference." If it can figure out what the type of something is, Rust
doesn't require you to actually type it out.

We can add the type if we want to. Types come after a colon (`:`):
We can add the type if we want to, though. Types come after a colon (`:`):

```{rust}
let x: int = 5;
Expand Down Expand Up @@ -1281,15 +1277,15 @@ two main looping constructs: `for` and `while`.

The `for` loop is used to loop a particular number of times. Rust's `for` loops
work a bit differently than in other systems languages, however. Rust's `for`
loop doesn't look like this C `for` loop:
loop doesn't look like this "C style" `for` loop:

```{ignore,c}
```{c}
for (x = 0; x < 10; x++) {
printf( "%d\n", x );
}
```

It looks like this:
Instead, it looks like this:

```{rust}
for x in range(0i, 10i) {
Expand All @@ -1312,10 +1308,9 @@ valid for the loop body. Once the body is over, the next value is fetched from
the iterator, and we loop another time. When there are no more values, the
`for` loop is over.

In our example, the `range` function is a function, provided by Rust, that
takes a start and an end position, and gives an iterator over those values. The
upper bound is exclusive, though, so our loop will print `0` through `9`, not
`10`.
In our example, `range` is a function that takes a start and an end position,
and gives an iterator over those values. The upper bound is exclusive, though,
so our loop will print `0` through `9`, not `10`.

Rust does not have the "C style" `for` loop on purpose. Manually controlling
each element of the loop is complicated and error prone, even for experienced C
Expand Down
8 changes: 4 additions & 4 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ There are questions that are asked quite often, and so we've made FAQs for them:

# The standard library

You can find function-level documentation for the entire standard library
[here](std/index.html). There's a list of crates on the left with more specific
sections, or you can use the search bar at the top to search for something if
you know its name.
We have [API documentation for the entire standard
library](std/index.html). There's a list of crates on the left with more
specific sections, or you can use the search bar at the top to search for
something if you know its name.

# External documentation

Expand Down