Skip to content

Commit

Permalink
Fix Solution collapse in Groovy section
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Ribeiro-Dantas <mribeirodantas@seqera.io>
  • Loading branch information
mribeirodantas committed Jan 12, 2024
1 parent 829b129 commit 3116138
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions docs/basic_training/groovy.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,22 @@ assert list[0] == 10

??? Solution

Your solution could look something similar to this:
Your solution could look something similar to this:

```groovy linenums="1" title="snippet.nf"
list = [10, 20, 30, 40]
```groovy linenums="1" title="snippet.nf"
list = [10, 20, 30, 40]

assert list[0] == 11
```
assert list[0] == 11
```

You should see an error message similar to this:
You should see an error message similar to this:

```console title="Output"
ERROR ~ assert list[0] == 11
| |
| 10
[10, 20, 30, 40]
```
```console title="Output"
ERROR ~ assert list[0] == 11
| |
| 10
[10, 20, 30, 40]
```

Lists can also be indexed with negative indexes and reversed ranges.

Expand Down Expand Up @@ -274,19 +274,19 @@ $x + $y

??? Solution

Modify `println '$x $y'` to `println "$x $y"`.
Modify `println '$x $y'` to `println "$x $y"`.

```groovy linenums="1" title="snippet.nf"
```groovy linenums="1" title="snippet.nf"

```groovy linenums="1" title="snippet.nf"
foxtype = 'quick'
foxcolor = ['b', 'r', 'o', 'w', 'n']
println "The $foxtype ${foxcolor.join()} fox"
```groovy linenums="1" title="snippet.nf"
foxtype = 'quick'
foxcolor = ['b', 'r', 'o', 'w', 'n']
println "The $foxtype ${foxcolor.join()} fox"

x = 'Hello'
y = 'World'
println "$x $y"
```
x = 'Hello'
y = 'World'
println "$x $y"
```

Finally, string literals can also be defined using the `/` character as a delimiter. They are known as **slashy** strings and are useful for defining regular expressions and patterns, as there is no need to escape backslashes. As with double-quote strings they allow to interpolate variables prefixed with a `$` character.

Expand Down Expand Up @@ -430,24 +430,24 @@ Hello

??? Solution

Your solution could look something similar to this:
Your solution could look something similar to this:

```groovy linenums="1" title="snippet.nf"
x = 11
```groovy linenums="1" title="snippet.nf"
x = 11

if (x > 10)
println 'Hello'
else
println 'Goodbye'
```
if (x > 10)
println 'Hello'
else
println 'Goodbye'
```

Or this:
Or this:

```groovy linenums="1" title="snippet.nf"
x = 11
```groovy linenums="1" title="snippet.nf"
x = 11

println x > 10 ? 'Hello' : 'Goodbye'
```
println x > 10 ? 'Hello' : 'Goodbye'
```

!!! cboard-list-2 "Summary"

Expand Down

0 comments on commit 3116138

Please # to comment.