Skip to content

Commit 4cf011c

Browse files
committed
---
yaml --- r: 36857 b: refs/heads/try2 c: 201039c h: refs/heads/master i: 36855: 8af0395 v: v3
1 parent ae7eaee commit 4cf011c

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 107b2e5348c21a1824d4f3659c66125eb137546e
8+
refs/heads/try2: 201039cf0d1d63afa784dbfd54a7b200ecdb884f
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/doc/tutorial.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ let my_variable = 100;
249249
type MyType = int; // some built-in types are _not_ camel case
250250
~~~
251251

252-
## Expression syntax
252+
## Expressions and semicolons
253253

254254
Though it isn't apparent in all code, there is a fundamental
255255
difference between Rust's syntax and predecessors like C.
@@ -308,12 +308,14 @@ fn is_four(x: int) -> bool {
308308
}
309309
~~~~
310310

311-
## Literals
311+
## Primitive types and literals
312312

313+
There are general signed and unsigned integer types, `int`, and `uint`,
314+
as well as 8-, 16-, 32-, and 64-bit variations, `i8`, `u16`, etc.
313315
Integers can be written in decimal (`144`), hexadecimal (`0x90`), or
314316
binary (`0b10010000`) base. Each integral type has a corresponding literal
315317
suffix that can be used to indicate the type of a literal: `i` for `int`,
316-
`u` for `uint`, and `i8` for the `i8` type, etc.
318+
`u` for `uint`, `i8` for the `i8` type.
317319

318320
In the absence of an integer literal suffix, Rust will infer the
319321
integer type based on type annotations and function signatures in the
@@ -328,19 +330,21 @@ let c = 100u; // c is a uint
328330
let d = 1000i32; // d is an i32
329331
~~~~
330332

331-
Floating point numbers are written `0.0`, `1e6`, or `2.1e-4`. Without
332-
a suffix, the literal is assumed to be of type `float`. Suffixes `f32`
333-
(32-bit) and `f64` (64-bit) can be used to create literals of a
334-
specific type.
333+
There are three floating point types, `float`, `f32`, and `f64`.
334+
Floating point numbers are written `0.0`, `1e6`, or `2.1e-4`.
335+
Like integers, floating point literals are inferred to the correct type.
336+
Suffixes `f`, `f32` and `f64` can be used to create literals of a specific type.
335337

336-
The unit literal is written just like the type: `()`. The keywords
337-
`true` and `false` produce the boolean literals.
338+
The keywords `true` and `false` produce literals of type `bool`.
338339

339-
Character literals are written between single quotes, as in `'x'`. Just like
340-
C, Rust understands a number of character escapes, using the backslash
340+
Characters, the `char` type, are 4-byte unicode codepoints,
341+
whose literals are written between single quotes, as in `'x'`.
342+
Just like C, Rust understands a number of character escapes, using the backslash
341343
character, such as `\n`, `\r`, and `\t`. String literals,
342-
written between double quotes, allow the same escape sequences. Rust strings
343-
may contain newlines.
344+
written between double quotes, allow the same escape sequences.
345+
More on strings [later](#vectors-and-strings).
346+
347+
The nil type, written `()`, has a single value, also written `()`.
344348

345349
## Operators
346350

0 commit comments

Comments
 (0)