Using a function: calls and arguments

Syntax and values

A call asks a function to do its job. The supplied values are its arguments; the names that receive them in a function definition are parameters. A signature summarizes the call shape. Follow one call step by step.

Calling a function means asking it to do its job. The values you give it are its arguments. Some simple calls can also be written in Pliro command form.

Parenthesized calls are expressions:

say("Hello")
let result = length([10, 20, 30])
let value = makeFunction()(4)

A call can use an empty argument list and can be nested inside another
expression. Argument lists accept a trailing comma.

For readability, a call used as a whole statement may omit parentheses:

say "Hello"
say "Score:", score
forward 100

The command target may be an identifier or member chain, and multiple
arguments require commas. The command and parenthesized forms produce the same
canonical call operation.

Zero-argument calls always need parentheses:

penUp()
clear()
exitApp()

Use parentheses when a command’s first argument starts with a list, grouping,
or unary sign:

say([1, 2, 3])
say(-1)
say((2 + 3) * 4)

An arbitrary expression is also a valid statement. Its value is normally
discarded. Interactive REPL and immediate-console sessions display a non-none
top-level expression result.

Example

# language: en
say("Pliro")
say "Pliro", 12
say([1, 2, 3])

Syntax and values · Built-ins · Programming guides