12 / 16

Predefined functions

We saw that you can calculate simple number expressions with operators like +, -, *, / and %.
For Booleans we have operators &&, || and !. You can also concatenate a value to a String with +.

But in real programs you "don't reinvent the wheel", you rely on existing code. We need to store that code somewhere, give it a name and parametrize it. This is what functions are for!

FlowRun provides lots of useful function out of the box.
Try to output these expressions:

  • abs(-456.31)
  • pow(10, 2)
  • length("abcd")
  • randomInt(10)

The syntax is like in maths: a function name, and in parens you write its arguments separated by commas. You can have a function with zero arguments.

In the expressions above, we say that we call or invoke or execute a function.