|
I tried in the REPL and I was surprised to see no output of "hallo" in the terminal. Given that
|
Replies: 1 comment 1 reply
|
This is Nu's multi-line command syntax which allows for calling commands and wrapping their arguments across multiple lines. Your example is exactly as if you wrote If you want a pipeline to only print "hallo" if the assertion is true, split them up on separate lines, or separate them with a semicolon: > assert (4 == 4); "hallo" | print
hallo
> assert (4 != 4); "hallo" | print
Error: nu::shell::error
× Assertion failed.
╭─[repl_entry #15:1:8]
1 │ assert (4 != 4); "hallo" | print
· ────┬───
· ╰── It is not true.
╰──── |
This is Nu's multi-line command syntax which allows for calling commands and wrapping their arguments across multiple lines. Your example is exactly as if you wrote
assert (4 == 4) "hallo" | print, which outputs nothing since"hallo"is being passed as a second argument toassertand is ignored.If you want a pipeline to only print "hallo" if the assertion is true, split them up on separate lines, or separate them with a semicolon: