Skip to content

Built-in Functions

The built-in functions live in one table, separate from user functions. They are not reserved words, so the lexer treats len as an ordinary name. The interpreter still refuses to let or const that name, and it refuses to call it as a value. A program calls len(items) . It cannot store len in a variable.

Keeping them out of the keyword list means the grammar does not grow every time a helper is added. Protecting the names means a script cannot replace int or print 's neighbouring helpers and then behave differently.

Checks

Every built-in checks how many arguments it received and what types they are. The wrong count is an argument error. The wrong type is a type error. A value of the right type that still cannot be used, such as sqrt of a negative number or int of the text "no" , is a value error.

input writes its prompt with no extra newline and returns one line from standard input without the terminating newline. args returns a fresh list of the script arguments, so a script can append to the result without changing the next call. exit raises the host SystemExit with the given integer. The command-line entry point turns that into the process status.

The full list of names and their results is in the Reference .