A function is a section of code that can be called from the script to perform a certain "function". There are two sorts of functions in AutoIt, built-in functions and user functions.
The full list of built-in functions is here and the notes on using them are here.
User functions are declared using the Func...EndFunc statements.
Functions can accept parameters and return values as required.
Function names must start with either a letter or an underscore, and the remainder of the name can contain any combination of letters and numbers and underscores. Some valid function names are:
Here is an example of using a function to double a number 10 times:
$val = 10
For $i = 1 To 10
$doubled = MyDouble($val)
MsgBox(0, "", $val & " doubled is " & $doubled)
$val = $doubled
$value = $value * 2