Skip to content

Commit cfb87f1

Browse files
committed
auto merge of #12210 : zr40/rust/patch-1, r=cmr
According to kimundi on IRC, the current term for `()` is 'unit'. This commit updates tutorial.md to change 'nil' to 'unit' where `()` is described.
2 parents 58eeb07 + 4f72c01 commit cfb87f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/tutorial.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ braced block gives the whole block the value of that last expression.
293293

294294
Put another way, the semicolon in Rust *ignores the value of an expression*.
295295
Thus, if the branches of the `if` had looked like `{ 4; }`, the above example
296-
would simply assign `()` (nil or void) to `price`. But without the semicolon, each
296+
would simply assign `()` (unit or void) to `price`. But without the semicolon, each
297297
branch has a different value, and `price` gets the value of the branch that
298298
was taken.
299299

@@ -352,7 +352,7 @@ before the opening and after the closing quote, and can contain any sequence of
352352
characters except their closing delimiter. More on strings
353353
[later](#vectors-and-strings).
354354

355-
The nil type, written `()`, has a single value, also written `()`.
355+
The unit type, written `()`, has a single value, also written `()`.
356356

357357
## Operators
358358

@@ -852,7 +852,7 @@ fn line(a: int, b: int, x: int) -> int {
852852
It's better Rust style to write a return value this way instead of
853853
writing an explicit `return`. The utility of `return` comes in when
854854
returning early from a function. Functions that do not return a value
855-
are said to return nil, `()`, and both the return type and the return
855+
are said to return unit, `()`, and both the return type and the return
856856
value may be omitted from the definition. The following two functions
857857
are equivalent.
858858

0 commit comments

Comments
 (0)