Skip to content

Commit 3bf499b

Browse files
committed
---
yaml --- r: 38132 b: refs/heads/try c: e0f9f89 h: refs/heads/master v: v3
1 parent cf0c6ae commit 3bf499b

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 9cbc0fd0d9cee2f4138226c3bfd612788ddc5433
5+
refs/heads/try: e0f9f89c6575c79fc2afba6abf0c17c384c81e3b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/doc/tutorial.md

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -308,46 +308,6 @@ fn is_four(x: int) -> bool {
308308
}
309309
~~~~
310310

311-
If all those things are expressions, you might conclude that you have
312-
to add a terminating semicolon after *every* statement, even ones that
313-
are not traditionally terminated with a semicolon in C (like `while`).
314-
That is not the case, though. Expressions that end in a block only
315-
need a semicolon if that block contains a trailing expression. `while`
316-
loops do not allow trailing expressions, and `if` statements tend to
317-
only have a trailing expression when you want to use their value for
318-
something—in which case you'll have embedded it in a bigger statement.
319-
320-
~~~
321-
# fn foo() -> bool { true }
322-
# fn bar() -> bool { true }
323-
# fn baz() -> bool { true }
324-
// `let` is not an expression, so it is semicolon-terminated;
325-
let x = foo();
326-
327-
// When used in statement position, bracy expressions do not
328-
// usually need to be semicolon terminated
329-
if x {
330-
bar();
331-
} else {
332-
baz();
333-
} // No semi-colon
334-
335-
// Although, if `bar` and `baz` have non-nil return types, and
336-
// we try to use them as the tail expressions, rustc will
337-
// make us terminate the expression.
338-
if x {
339-
bar()
340-
} else {
341-
baz()
342-
}; // Semi-colon to ignore non-nil block type
343-
344-
// An `if` embedded in `let` again requires a semicolon to terminate
345-
// the `let` statement
346-
let y = if x { foo() } else { bar() };
347-
~~~
348-
349-
This may sound intricate, but it is super-useful and will grow on you.
350-
351311
## Types
352312

353313
The basic types include the usual boolean, integral, and floating-point types.

0 commit comments

Comments
 (0)