Skip to content

Commit

Permalink
Fix some more bugs in the tutorial
Browse files Browse the repository at this point in the history
Tutorial code going out of date is going to be a recurring problem...
  • Loading branch information
marijnh committed Nov 7, 2011
1 parent ce8c5b0 commit ba57ec2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions doc/tutorial/intro.md
Expand Up @@ -27,10 +27,10 @@ a language can be made easier if the notation looks familiar. Rust is
a curly-brace language in the tradition of C, C++, and JavaScript.

fn fac(n: int) -> int {
let result = 1;
while n > 0 {
result *= n;
n -= 1;
let result = 1, i = 1;
while i <= n {
result *= i;
i += 1;
}
ret result;
}
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial/syntax.md
Expand Up @@ -329,7 +329,7 @@ The compiler defines a few built-in syntax extensions. The most useful
one is `#fmt`, a printf-style text formatting macro that is expanded
at compile time.

std::io::writeln(#fmt("%s is %d", "the answer", 42));
std::io::println(#fmt("%s is %d", "the answer", 42));

`#fmt` supports most of the directives that [printf][pf] supports, but
will give you a compile-time error when the types of the directives
Expand All @@ -341,4 +341,4 @@ All syntax extensions look like `#word`. Another built-in one is
`#env`, which will look up its argument as an environment variable at
compile-time.

std::io::writeln(#env("PATH"));
std::io::println(#env("PATH"));

0 comments on commit ba57ec2

Please sign in to comment.