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