Skip to content

Commit c69e425

Browse files
committed
---
yaml --- r: 32764 b: refs/heads/dist-snap c: 2e7ddee h: refs/heads/master v: v3
1 parent 11dbcb9 commit c69e425

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 3b89dcbdf2de3f757556639cd7323c60d343c4d2
10+
refs/heads/dist-snap: 2e7ddee8239ceba5989c5dfd83e9a935775b00d1
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/doc/tutorial.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,13 @@ paretheses, while their bodies *must* be wrapped in
204204
brackets. Single-statement, bracket-less bodies are not allowed.
205205

206206
~~~~
207-
# fn calibrate_universe() -> bool { false }
208-
# fn party_on() {}
209-
# fn panic() {}
207+
# fn recalibrate_universe() -> bool { true }
210208
fn main() {
211-
while calibrate_universe() {
212-
/* Ensure that basic math still operates is expected */
213-
if 2*20 > 30 {
214-
party_on(); // That's a relief
215-
} else {
216-
panic();
209+
/* A simple loop */
210+
loop {
211+
// A tricky calculation
212+
if recalibrate_universe() {
213+
return;
217214
}
218215
}
219216
}
@@ -438,10 +435,9 @@ The nil literal is written just like the type: `()`. The keywords
438435

439436
Character literals are written between single quotes, as in `'x'`. Just as in
440437
C, Rust understands a number of character escapes, using the backslash
441-
character, `\n`, `\r`, and `\t` being the most common.
442-
443-
String literals allow the same escape sequences. They are written
444-
between double quotes (`"hello"`). Rust strings may contain newlines.
438+
character, `\n`, `\r`, and `\t` being the most common. String literals,
439+
written between double quotes, allow the same escape sequences. Rust strings
440+
may contain newlines.
445441

446442
## Operators
447443

@@ -482,14 +478,19 @@ a syntax extension is being used, the names of all syntax extensions end with
482478
which is `fmt!`, a `sprintf`-style text formatter that is expanded at compile
483479
time.
484480

485-
~~~~
486-
io::println(fmt!("%s is %d", ~"the answer", 42));
487-
~~~~
488-
489481
`fmt!` supports most of the directives that [printf][pf] supports, but
490482
will give you a compile-time error when the types of the directives
491483
don't match the types of the arguments.
492484

485+
~~~~
486+
# let mystery_object = ();
487+
488+
io::println(fmt!("%s is %d", "the answer", 43));
489+
490+
// %? will conveniently print any type
491+
io::println(fmt!("what is this thing: %?", mystery_object));
492+
~~~~
493+
493494
[pf]: http://en.cppreference.com/w/cpp/io/c/fprintf
494495

495496
You can define your own syntax extensions with the macro system, which is out
@@ -505,11 +506,11 @@ compulsory, an optional `else` clause can be appended, and multiple
505506

506507
~~~~
507508
if false {
508-
io::println(~"that's odd");
509+
io::println("that's odd");
509510
} else if true {
510-
io::println(~"right");
511+
io::println("right");
511512
} else {
512-
io::println(~"neither true nor false");
513+
io::println("neither true nor false");
513514
}
514515
~~~~
515516

0 commit comments

Comments
 (0)