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_data
of typeint
and returns a single return value that is identified usingÂ_output
of typeint
. Thefunction
signature provides constructs to define both the incoming parameters and return values. Thereturn
keyword in thefunction
signature helps define the return types from the function. In the following code snippet, thereturn
keyword within the function code automatically...