92
F# Modules
Module is a collection of classes, functions, and types. It helps to organize related code so we can maintain code easily.
It is implemented as a common language runtime (CLR) class which has only static members.
Syntax:
If you do not specify or declare module in your code, implicitly a module is created with the same name as file name without the extension. The first letter of file is converted to upper letter.
F# Module Example
You can access all methods of module Arithmetic by using two different ways.
- Fully qualify the function name
- Open the module
F# Module Example: by using fully qualify the function name
Output:
30
F# Module Example: By using open the module
Output:
10
Next TopicF# Access Control