In a statically typed language such as solidity, the type of each variable needs to be specified at compile time. To support this, solidity provides both inbuilt data types and user-defined data types. These elementary types include integer, Boolean, mapping, struct, and so on. Apart from these types, solidity allows defining functions a type. This helps to add several features such as invoking a dynamic callback function after a certain task.
In this recipe, you will learn to create and use functions as a type in solidity.