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 invent the wheel", you rely on existing code.
We need to "store" that code somewhere, and parametrize it with variables.
That is what functions are for!
FlowRun provides lots of useful function out of the box.
Most of them are easy to understand.
Try to output these expressions:
abs(-456.31)
real2int(3.14)
length("abcd")
randomInt(10)
The syntax is simple: you write a function name, and in parens you write its arguments separated by commas.
Of course, you can have a function with zero arguments.
In the expressions above, we say that we call or invoke a function.