diff --git a/content/blog/2020/groovy3-syntax-sugar.md b/content/blog/2020/groovy3-syntax-sugar.md index 094423f0c..229769766 100644 --- a/content/blog/2020/groovy3-syntax-sugar.md +++ b/content/blog/2020/groovy3-syntax-sugar.md @@ -1,13 +1,11 @@ - - -# More syntax sugar for Nextflow developers +~~~~~~ The latest Nextflow version 2020.10.0 is the first stable release running on Groovy 3. @@ -18,13 +16,13 @@ Along with this, the new Groovy runtime brings a whole lot of syntax enhancement the everyday life of pipeline developers. Let's see them more in detail. -## Improved not operator +### Improved not operator The `!` (not) operator can now prefix the `in` and `instanceof` keywords. This makes for more concise writing of some conditional expression, for example, the following snippet: ``` -list = [10,20,30] +list = [10,20,30] if( !(x in list) ) { // .. @@ -37,7 +35,7 @@ else if( !(x instanceof String) ) { could be replaced by the following: ``` -list = [10,20,30] +list = [10,20,30] if( x !in list ) { // .. @@ -51,7 +49,7 @@ Again, this is a small syntax change which makes the code a little more readable. -## Elvis assignment operator +### Elvis assignment operator The elvis assignment operator `?=` allows the assignment of a value only if it was not previously assigned (or if it evaluates to `null`). Consider the following example: @@ -77,6 +75,8 @@ if( some_variable != null ) { } ``` +If you are wondering why it's called *Elvis* assigment, well it's simple, because there's also the [Elvis operator](https://groovy-lang.org/operators.html#_elvis_operator) that you should know (and use!) already. 😆 + ### Java style lambda expressions Groovy 3 supports the syntax for Java lambda expression. If you don't know what a Java lambda expression is diff --git a/output/blog.html b/output/blog.html index 9ea6eaec9..60ff90840 100644 --- a/output/blog.html +++ b/output/blog.html @@ -107,6 +107,32 @@

Blogging about Nextflow, computational workflows, contain
+
+

More syntax sugar for Nextflow developers!

+ +
    +
  • Paolo Di Tommaso
  • +
  • 03 November 2020
  • + +
+
+

+ +

The latest Nextflow version 2020.10.0 is the first stable release running on Groovy 3.

The first benefit of this change is that now Nextflow can be compiled and run on any modern Java virtual machine, from Java 8, all the way up to the latest Java 15!

Along with this, the new Groovy runtime brings a whole lot of syntax enhancements that can be useful in the everyday life of .. (click here to read more) + +

+ + +

The Nextflow CLI - tricks and treats!