Function Annotations
Function annotations serve a similar purpose to type annotations, in that they tell the compiler what type of function to assign to this variable. This can be done either by assigning the type to a local variable or in the function itself.
The code above demonstrates how to utilize function annotations correctly. Note that primitive types are interchangeable. If the types of functions are not identical to the definition, then the compiler will throw an exception. Below is another example of how to annotate a function with types:
Last updated