> ## Documentation Index
> Fetch the complete documentation index at: https://docs.standardcomputers.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Defining and Calling Functions in Standard Language

> Define reusable functions in the Standard language with or without arguments, and call them by name to run your logic anywhere in your code.

Functions let you group a set of instructions under a single name so you can reuse them throughout your program without repeating code. In Standard, defining a function is straightforward: start a new line with the function name, optionally follow it with a `:` if the function accepts arguments, then open a block with `{` and close it with `}` on its own line.

```text theme={null}
myFunc {
    print "Hello"
}
myFunc #Prints 'Hello'

sayHello: name {
    print ("Hello ".name."!")
}
sayHello: "Kenny" #Prints 'Hello Kenny!'
```

<Note>
  Function names follow the same naming rules as variables — they must be alphanumeric, cannot start with a number or special character, and cannot share a name with a Standard reserved word. See [Variables & Types](/code/variables-types) for the full list of reserved words.
</Note>

## Defining a Function

<Steps>
  <Step title="Choose a name">
    Pick a descriptive, alphanumeric name that is not a reserved word and does not conflict with any variable name in your program.
  </Step>

  <Step title="Declare arguments (optional)">
    If your function needs input, follow the name with `:` and then the argument name(s). Omit the `:` entirely for functions that take no arguments.
  </Step>

  <Step title="Write the function body">
    Open the block with `{` on the same line as the function name, write your code on the lines that follow, and close the block with `}` on its own line.
  </Step>
</Steps>

## Calling a Function

To call a function with no arguments, write its name on a new line. To call a function that expects arguments, write its name followed by `:` and the value(s) to pass in:

```text theme={null}
myFunc          #No arguments
sayHello: "Kenny"  #With an argument
```
