Skip to content

Commit

Permalink
Document spread dot and safe dot
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Nov 19, 2024
1 parent 7551933 commit 6477553
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/reference/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,12 @@ myList[0]

### Property expression

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

```nextflow
file.text
myFile.text // dot
myFiles*.text // spread dot: myFiles.collect { myFile -> myFile.text }
myFile?.text // safe dot: myFile != null ? myFile.text : null
```

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

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

```nextflow
myList.size()
myFile.getText() // dot
myFiles*.getText() // spread dot: myFiles.collect { myFile -> myFile.getText() }
myFile?.getText() // safe dot: myFile != null ? myFile.getText() : null
```

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

0 comments on commit 6477553

Please sign in to comment.