Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Expression

Expressions are airthmetic or logical operations. They can appear inside the conditional statements, or as input to a task, or nested in other expression or function calls.

Expressions are defined into the following categories:

Literal Values

env [1, true, "no maybe"]

Results:

[1, true, "no maybe"]

Variable

env.value = [1, true, "no maybe"];
env.value

Results:

[1, true, "no maybe"]

Variables also have a “check” mode, where it returns true if variable exists, false if it does not.

env.value = [1, true, "no maybe"];
env value?
env other_var?

Results:

true
false

You can also use use varible from node, or network in other context. For example:

env.value = [1, true, "no maybe"];
network echo(json(env.value))

Results:

[1, true, "no maybe"]

Special variable types like nodes, inputs, output are available besides env, network and node based on what type of task the expression is on.

You will learn more about this on Cross Context Functions and Variables chapter.

Unary Operator

env !true
env - 12.0

Results:

false
-12

Binary Operator

env (12 > 34) & true
env "x" in "xyz"
env 12 in [123, true]
env "my name is" match "^my.*"

Results:

false
true
false
true

If Else

env if(!true) {"if true"} else {"if false"}

Results:

"if false"

Function

env.value = [1, true, "no maybe"];
env get(value, 2)

Results:

"no maybe"

Out of all expressions, only the function is not garanteed to return a value. If you are using a function expression and expect a value and it does not return it, it’ll be a runtime error.

env echo("Hello world!") + 12

*Error*:

Hello world!

Function echo did not return a value

Special function types like nodes, inputs, output are available besides env, network and node based on what type of task the expression is on.

You will learn more about this on Cross Context Functions and Variables chapter.