File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Tuple expressions
4
4
5
+ > ** <sup >Syntax</sup >**
6
+ > _ TupleExpression_ :
7
+ >   ;  ;   ;  ; ` ( ` ` ) `
8
+ >   ;  ; | ` ( ` ( [ _ Expression_ ] ` , ` )<sup >+</sup > [ _ Expression_ ] <sup >?</sup > ` ) `
9
+
5
10
Tuples are written by enclosing zero or more comma-separated expressions in
6
11
parentheses. They are used to create [ tuple-typed] ( types.html#tuple-types )
7
12
values.
@@ -22,6 +27,10 @@ comma:
22
27
23
28
## Tuple indexing expressions
24
29
30
+ > ** <sup >Syntax</sup >**
31
+ > _ TupleIndexingExpression_ :
32
+ >   ;  ; [ _ Expression_ ] ` . ` [ TUPLE_INDEX]
33
+
25
34
[ Tuples] ( types.html#tuple-types ) and [ struct tuples] ( items/structs.html ) can be
26
35
indexed using the number corresponding to the position of the field. The index
27
36
must be written as a [ decimal literal] ( tokens.html#integer-literals ) with no
@@ -36,3 +45,6 @@ assert_eq!(pair.1, 2);
36
45
let unit_x = Point (1.0 , 0.0 );
37
46
assert_eq! (unit_x . 0 , 1.0 );
38
47
```
48
+
49
+ [ TUPLE_INDEX ] : tokens.html#integer-literals
50
+ [ _Expression_ ] : expressions.html
You can’t perform that action at this time.
0 commit comments