Function input and output
Functions would not be that interesting if they didn't accept parameters and return values. Functions are made generic with the use of parameters and return values. Parameters can help in changing function execution and providing different execution paths. Solidity allows you to accept multiple parameters within the same function; the only condition is that their identifiers should be uniquely named.
The following code snippets show the following multiple functions, each with different constructs for parameters and return values:
- The first function,Â
singleIncomingParameter, accepts one parameter named_dataof typeintand returns a single return value that is identified usingÂ_outputof typeint. Thefunctionsignature provides constructs to define both the incoming parameters and return values. Thereturnkeyword in thefunctionsignature helps define the return types from the function. In the following code snippet, thereturnkeyword within the function code automatically...