# Functions

## Introduction

Define the Name of this Function. A function's name is used to name and differentiate functions. It is advised that the name be specific and descriptive enough to be able to infer the function's purpose and distinguish it from other functions. Furthermore, the name will be utilized in the code as keyword to name the function

## Configuration

**Function Visibility**

Define the visibility of your function to determine how it can be called:

* **Public**: Can be called both from inside the contract and from the outside world.
* **External**: Similar to public but intended to be called from outside the contract.
* **Internal**: Can only be called from within the contract and by derived contracts.
* **Private**: Can only be called from within the contract and not inherited by derived contracts.

This setup allows you to control the accessibility and behavior of your functions, ensuring they operate as intended within your smart contract.

<figure><img src="/files/mqPonS4eNF8iK6AO7h7y" alt=""><figcaption></figcaption></figure>

Define whether the Function should be Payable, i.e. whether it can receive currency into the contract.

Define the Input for this Function. This definition only pertains to the function's signature, i.e. it is used to establish the type of Data Entities that the function will require as input, if any.

Define the Return for this Function. This definition only pertains to the function's signature, i.e. it is used to establish the type of Data Entity that the function will return, if any.

<figure><img src="/files/KnZtAetes01m69qwiwQS" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Custom Functions are custom user-defined functions. After defining a function's properties such as its name and input/return, one will be able to design the function's flow by clicking on the dedicated button.

&#x20;![](/files/GgaBVoneyRJUEbngLYGg)
{% endhint %}

**Cross-Contract Function**

Define whether this function is Cross-Contract, meaning whether other contracts within this project should be able to use this function as if it were defined as their own. Enabling Cross-Contract functionality allows for greater modularity and reusability across different contracts in the project.

**Function Modifiers**

Define whether this function will be utilizing any Modifiers. Function modifiers are used to alter a function's behavior by, for example, specifying prerequisites that must be checked before the function is executed. Modifiers can enhance functionality, such as ensuring certain conditions are met or adding additional security checks.

By specifying these attributes, you can control the accessibility and behavior of your functions, making them more versatile and secure within your smart contract.

<figure><img src="/files/dEc5aQ5vruI0EScukvbk" alt=""><figcaption></figcaption></figure>


---

# 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://docs.astrakode.tech/akb-wiki/astrakode-wiki/smart-contract-ide/technologies/ethereum/components/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.
