79
F# Type Annotation
F# allows type annotation. By using type annotation you can explicitly mention the type of identifier, parameter, return value of a function. You must use: (colon) to apply annotation in F#.
Let’s see where and how we can apply type annotation.
- Type annotation in variable (identifier)
- Type annotation in function parameter and return type
F# Type Annotation in variable (identifier) Example
Here, we are explicitly mentioning type of variable followed by: (colon).
Output:
10
F# Type Annotation in Function Example
Here, we are using type annotation in parameters and return value.
Output:
30
Next TopicF# Do Bindings