Skip to content

Commit 8cb3da5

Browse files
committed
docs: Tweaks
1 parent fafce9a commit 8cb3da5

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

doc/tutorial.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -872,17 +872,6 @@ is optionally followed by an expression to return. A function can
872872
also return a value by having its top level block produce an
873873
expression.
874874

875-
~~~~
876-
# const copernicus: int = 0;
877-
fn int_to_str(i: int) -> ~str {
878-
if i == copernicus {
879-
return ~"tube sock";
880-
} else {
881-
return ~"violin";
882-
}
883-
}
884-
~~~~
885-
886875
~~~~
887876
fn line(a: int, b: int, x: int) -> int {
888877
a*x + b
@@ -1122,7 +1111,7 @@ let x = ~10;
11221111
let y = copy x;
11231112
11241113
let z = *x + *y;
1125-
assert z = 20;
1114+
assert z == 20;
11261115
~~~~
11271116

11281117
This is where the 'move' operator comes in. It is similar to
@@ -1131,7 +1120,7 @@ from `x` to `y`, without violating the constraint that it only has a
11311120
single owner (if you used assignment instead of the move operator, the
11321121
box would, in principle, be copied).
11331122

1134-
~~~~ {.ignore}
1123+
~~~~ {.xfail-test}
11351124
let x = ~10;
11361125
let y = move x;
11371126
@@ -1273,7 +1262,7 @@ also done with square brackets (zero-based):
12731262
# BananaMania, Beaver, Bittersweet };
12741263
# fn draw_scene(c: Crayon) { }
12751264
1276-
let crayons: [Crayon] = [BananaMania, Beaver, Bittersweet];
1265+
let crayons: [Crayon * 3] = [BananaMania, Beaver, Bittersweet];
12771266
match crayons[0] {
12781267
Bittersweet => draw_scene(crayons[0]),
12791268
_ => ()
@@ -1290,7 +1279,7 @@ elements. Mutable vector literals are written `[mut]` (empty) or `[mut
12901279
# Aquamarine, Asparagus, AtomicTangerine,
12911280
# BananaMania, Beaver, Bittersweet };
12921281
1293-
let crayons: [mut Crayon] = [mut BananaMania, Beaver, Bittersweet];
1282+
let crayons: [mut Crayon * 3] = [mut BananaMania, Beaver, Bittersweet];
12941283
crayons[0] = AtomicTangerine;
12951284
~~~~
12961285
@@ -1330,7 +1319,8 @@ Strings are implemented with vectors of `[u8]`, though they have a distinct
13301319
type. They support most of the same allocation options as
13311320
vectors, though the string literal without a storage sigil, e.g.
13321321
`"foo"` is treated differently than a comparable vector (`[foo]`).
1333-
Where
1322+
Wheras plain vectors are stack-allocated fixed length vectors,
1323+
plain strings are region pointers to read-only memory.
13341324
13351325
~~~
13361326
// A plain string is a slice to read-only (static) memory

0 commit comments

Comments
 (0)