--- title: "Functions Block" slug: "functions-block" updated: 2021-08-14T01:52:13Z published: 2021-08-14T01:52:13Z canonical: "help.pillir.io/functions-block" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.pillir.io/llms.txt > Use this file to discover all available pages before exploring further. # Functions Block ### Functions related blocks are explained below Functions are a set of codes that can be called repeatedly for a particular operation. The function is executed when something invokes it (calls it). In the EdgeReady Cloud, these functions are available as individual blocks. There are two types of functions: One that returns a value and one that does not return a value. In these blocks: - Function **parameters** are listed inside the blocks in the function definition. - Function **arguments** are the **values** received by the function when it is invoked. - Inside the function, the arguments (the parameters) behave as local variables. ## Create Function: This block helps users create new functions. The functions can be created: - Without Return Value - With Return Value - As a Global Function or local function | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Function Name Text, Arguments Name text, set as a global function checkbox, allow statements checkbox, Function statements. Return for a function of any type. | This block will create a function definition depending upon input arguments and the choice of whether they are global. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906181931.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906208072.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906225723.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906247786.png) | ```javascript var Name = function () { } window.Name = function (x, y) { } var Name2 = function () { return ''; } ``` | #### ## Invoke Function: Function invocation occurs when: - When an event occurs (when a user clicks a button) - When it is invoked (called) from another code block - Automatically (self invoked) In the EdgeReady Cloud, the function block is invoked: - With Return Value - Without Return Value - As a Global Function | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Function Name Text, Arguments variable or any type value. | Call the function definition using name and arguments. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906325038.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906373921.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906393411.png) | ```javascript Name('', ''); Name2() ``` | #### ## Function Definition with an input statement: In this function definition, an input statement is provided. The input function is used to request the user to provide necessary input in a designated input field. The value is then returned as the result of the function that is stored in the declared variable. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Arguments variable or any type value, Function statements. Return for a function of any type. | Create a function definition with return and input statements that store to a variable or as a value. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906434074.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906452217.png) | ```javascript function () { }; ``` | #### ## Function Definition without a statement: In this function definition block, there is no input that is requested from the user. However, this function can return a value based on the nature of the action triggered and parameters defined to invoke the function. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Arguments variable or any type value, Return for a function of any type. | Create a simple function definition with return only that store to a variable or as value. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906599406.png) | ```javascript function () { return ''; }; ``` |