# SyMAT Wiki

### Site Tools

code:functions

This is an old revision of the document!

# Built-in Functions

SyMAT has many built-in functions. These are available from JavaScript and Python.

## Input/Output/Storage

• notify(message): Display a pop-up box with the given message text and an OK button.
• ask(question): Display a pop-up box with the given question and an input box. Returns a String.
• print(text): Output a line of text to the Output box.
• readfile(filename): Read the contents of the given text file and return the data.
• savefile(filename,data): Write the given text data to a file.
• load(key): Return the text corresponding to the given key.
• save(key,text): Link the given text to the given key.

## Simple Math

• add(n,n,n…) OR add(n[]): Add together the given numbers or array of numbers and return the sum.
• subtract(n,n,n…) OR subtract(n[]): Subtract the given numbers or array of numbers and return the difference. Calculates from first number to last (i.e. n1-n2-n3).
• times(n,n,n…) OR times(n[]): Multiply together the given numbers or array of numbers and return the product.
• divide(n,n,n…) OR divide(n[]): Divide the given numbers or array of numbers and return the quotient. Calculates from first number to last (i.e. (n1/n2)/n3).
• mod(n,n,n…) OR mod(n[]): Calculate the modulus of the given numbers or array of numbers and return the result. Calculates from first number to last (i.e. (n1 mod n2) mod n3).