Skip to content

Commit 8fbf8ff

Browse files
authored
Document spread dot and safe dot (#5519) [ci skip]
Signed-off-by: Ben Sherman <[email protected]>
1 parent 99d4042 commit 8fbf8ff

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/reference/syntax.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,12 @@ myList[0]
767767

768768
### Property expression
769769

770-
A property expression consists of an *object expression* and a *property*, separated by a dot:
770+
A property expression consists of an *object expression* and a *property*, separated by a *dot*, *spread dot*, or *safe dot*:
771771

772772
```nextflow
773-
file.text
773+
myFile.text // dot
774+
myFiles*.text // spread dot: myFiles.collect { myFile -> myFile.text }
775+
myFile?.text // safe dot: myFile != null ? myFile.text : null
774776
```
775777

776778
The property must be an identifier or string literal.
@@ -783,10 +785,12 @@ A function call consists of a name and argument list:
783785
printf('Hello %s!\n', 'World')
784786
```
785787

786-
A *method call* consists of an *object expression* and a function call separated by a dot:
788+
A *method call* consists of an *object expression* and a function call separated by a *dot*, *spread dot*, or *safe dot*:
787789

788790
```nextflow
789-
myList.size()
791+
myFile.getText() // dot
792+
myFiles*.getText() // spread dot: myFiles.collect { myFile -> myFile.getText() }
793+
myFile?.getText() // safe dot: myFile != null ? myFile.getText() : null
790794
```
791795

792796
The argument list may contain any number of *positional arguments* and *named arguments*:

0 commit comments

Comments
 (0)