Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the responsive-lightbox domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114
Function Library

Function Library

Before moving to Function library, let’s understand what is a Function?

Function: As a definition, Function is nothing but a set of statements(code) combined to cover a particular functionality. Function are used for reusability.Let’s understand with an example.

Consider 2 scenarios.

First: We need to login into gmail and count the no. of emails in the inbox and then log out.

Second: We need to login into gmail and delete the first email and then log out.

As we can see that for both the scenarios ‘Login’ and ‘Log out’ functionalities are common. In both the scenarios, we have to perform login and logout.What can we do? So,we have to write the code only once, not 2 times and same code we can use for both the scenarios.

As a solution, we will write this common lines of code into a function.

Syntax:

Function func_Login()

‘Login code

End Function

How to make this function accessible to all the scripts or the users who are going to use the same Functionality?

For making it accessible to all, We will keep this function at a common place and that common place will be our Function Library.

Function Library: As we have book libraries, and anybody who wants to read the book can go to the book library and read the book whichever he/she wants. In the same way, we keep our function in a file called Function Library.

We just need to attach that library to our Action script and we can call the desired function stored into the function library.

How to create a Function Library?

Go to ‘File menu –> New –> Function Library’

Write your function and save it at any desired location. Function library can have the extension .qfl and .vbs.


Questions/Suggestions
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...