# Functions

You’ve already seen one of the most important functions in the language: the `main` function, which is the entry point of many programs. You’ve also seen the `fn` keyword, which allows you to declare new functions.

*Silicon* prefers *snake case* as the conventional style for function and variable names. In snake case, all letters are lowercase and underscores separate words.

{% code title="src/main.si" %}

```
extern fn printf(format: string, ...): i32;

fn hello_world() {
    printf("%s\n", "Hello World!");
}

fn main() {
    printf("%s\n", "Calling hello_world function...");
    
    hello_world();
}

```

{% endcode %}

Function definitions in *Silicon* start with `fn` and have a set of parentheses after the function name. The curly brackets tell the compiler where the function body begins and ends.

We can call any function we’ve defined by entering its name followed by a set of parentheses. Because `hello_world` is defined in the program, it can be called from inside the `main` function. Note that we defined `hello_world` *before* the `main` function in the source code.

#### Function Parameters

Functions can also be defined to have *parameters*, which are special variables that are part of a function’s signature. When a function has parameters, you can provide it with concrete values for those parameters. Technically, the concrete values are called *arguments*, but in casual conversation, people tend to use the words *parameter* and *argument* interchangeably for either the variables in a function’s definition or the concrete values passed in when you call a function.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://siliconlang.org/documents/functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
