Defining Methods
Typing
All method arguments MUST have a type and all methods MUST have an explicit return type.
Examples
Valid
Invalid
ABI Methods
All methods defined in your contract will be routed as ABI methods, unless they have the private
keyword. This means they will be exposed in the ABI and Application Spec generated by TEALScript.
Private Subroutines
A method defined with the private
keyword will only be accessible within the contract itself via a subroutine. This means other contracts or end-users cannot call this method directly and it will not be exposed in the ABI or Application Spec.
Example
In this example, there is a single public ABI method doMath
which will then call the add
or subtract
subroutines depending on the method given. doMath
is the only method that is externally callable.