Javatpoint Logo
Javatpoint Logo

Import Declarations: The open keyword

An import declaration specifies a module or namespace. You can reference it's elements without using a fully qualified name.

Syntax

F# allows you to use the open keyword for frequently used modules and namespaces. When you reference a member of frequently used module or namespace, you can use the short form of the name instead of the fully qualified name. This open keyword is similar to the using keyword in C#, and Imports in Visual Basic.

When you use multiple open declarations, they should appear on separate lines.


F# Import declaration Example

Output:

Hello, this is F# here.

Namespaces That Are import by Default in F#

In F#, some namespaces that are used most frequently is open by default. These namespaces are listed below in the table.

Namespace Description
Microsoft.FSharp.Core Contains basic F# type definitions for built-in types such as int and float.
Microsoft.FSharp.Core.Operators Contains basic arithmetic operations such as + and *.
Microsoft.FSharp.Collections Contains immutable collection classes such as List and Array.
Microsoft.FSharp.Control Contains types for control constructs such as lazy evaluation and asynchronous workflows.
Microsoft.FSharp.Text Contains functions for formatted IO, such as the printf function.




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA