about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-11-07 09:55:22 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2011-11-07 09:55:25 +0100
commitba57ec24ea432f06fcadd52da4aa82d550e2fc92 (patch)
treeaa250c1d9dac5a79abb83935fa3b15835b61cff2
parentce8c5b0340050e1285f69689d0e16ece4bea8cf9 (diff)
downloadrust-ba57ec24ea432f06fcadd52da4aa82d550e2fc92.tar.gz
rust-ba57ec24ea432f06fcadd52da4aa82d550e2fc92.zip
Fix some more bugs in the tutorial
Tutorial code going out of date is going to be a recurring problem...
-rw-r--r--doc/tutorial/intro.md8
-rw-r--r--doc/tutorial/syntax.md4
2 files changed, 6 insertions, 6 deletions
diff --git a/doc/tutorial/intro.md b/doc/tutorial/intro.md
index 7f59fa861f8..d0b08a73c73 100644
--- a/doc/tutorial/intro.md
+++ b/doc/tutorial/intro.md
@@ -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;
     }
diff --git a/doc/tutorial/syntax.md b/doc/tutorial/syntax.md
index d0bbf934f45..a3befca02d5 100644
--- a/doc/tutorial/syntax.md
+++ b/doc/tutorial/syntax.md
@@ -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
@@ -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"));