--- title: "Functions Component" slug: "functions-component" updated: 2023-02-13T09:56:09Z published: 2023-02-13T09:56:09Z canonical: "help.pillir.io/functions-component" --- > ## 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 Component 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 a Return Value - With a Return Value - As a Global Function or Local function - Global Function: Can be accessed in the behavior of other components within the same page only. - Local Function: Cannot be accessed outside the behavior of that specific component. | Input | Output | Block Layout | Generated Code | | --- | --- | --- | --- | | Function Name (Text) -input-1, Click the **settings** icon; Arguments Name (Text), Set Global Function checkbox, | This block will create a function definition based on input arguments and the choice of whether they are global. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906181931.png) ![CreateFunction](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/CreateFunction.png) | ```javascript var x1, x2; function er_1673932286_change(e,obj,index){ // Describe this function... window.GET = function (x1, x2) { }; } ``` | | Function Name (Text) -input-1, Click the **settings** icon; Arguments Name (Text), allow statements checkbox Set Global Function checkbox, | Creates a function with an output | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906225723.png) ![CreateFunction-with Return](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/CreateFunction-with%20Return.png) | ```javascript var x1, x2; function er_3eff8d47_6dd5_4f07_92d0_fd3d291010bd_onPageShow(e,obj,index){ // Describe this function... window.Get = function (x1, x2) { return 'Completed'; }; } ``` | ## Invoke Function The Invoke Function 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 invoke function block is invoked in the following ways: - 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. NoteClick the **settings** icon to add more arguments. | Calls the function definition using name and arguments with a return value | ![InvokeFunc-with return-new](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/InvokeFunc-with%20return-new.png)![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906373921.png) | ```javascript window.name(e); ``` | | Function Name (Text) Arguments - variable or any type value. | Calls the function definition using name and arguments without a return value | ![InvokeFunc-without return-new](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/InvokeFunc-without%20return-new.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906393411.png) | ```javascript window.test(err); ``` | ## 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 the input in a designated input field. The value is then returned as the result of the function that is stored in the declared variable. NoteThis function block is invoked as an **Anonymous** function. An anonymous function does not have any name associated with it and is not accessible after its initial creation, it can only be accessed by a variable it is stored in as a function as a value. An anonymous function can also have multiple arguments, but only one expression. | 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 var item; async function er_1674710886_click(e,obj,index){ item = async 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 the parameters defined to invoke the function. This function block is also invoked as an anonymous 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. It can be stored to a variable or as a value. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620906599406.png) | ```javascript var item; async function er_1674710886_click(e,obj,index){ item = async function(){return }; } ``` |