Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextflow review @bobturneruk ep4 ${...} #126

Open
ggrimes opened this issue Apr 23, 2024 · 1 comment
Open

Nextflow review @bobturneruk ep4 ${...} #126

ggrimes opened this issue Apr 23, 2024 · 1 comment

Comments

@ggrimes
Copy link
Collaborator

ggrimes commented Apr 23, 2024

Do inputs need to be wrapped in ${...} when used in a script? What is good practise?

@ggrimes
Copy link
Collaborator Author

ggrimes commented Apr 23, 2024

The nextflow variable don't have to wrapped in braces but it is useful when concatenate variable names with other strings, as the boundaries of the variable name can become unclear wittout the use of ${..}.

In the VARIABLE SUBSTITUTIONS callout I mention this.
Similar to bash scripting Nextflow uses the $ character to introduce variable substitutions. The variable name to be expanded may be enclosed in braces {variable_name}, which are optional but serve to protect the variable to be expanded from characters immediately following it which could be interpreted as part of the name. It is a good rule of thumb to always use the {} syntax because it enhances readability and clarity, ensures correct variable interpretation, and prevents potential syntax errors in complex expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant