Table of contents
TOC
Collapse the table of content
Expand the table of content

Keyword Reference (F#)

Den Delimarsky|Last Updated: 7/5/2016
|
1 Contributor

This topic contains links to information about all F# language keywords.

F# Keyword Table

The following table shows all F# keywords in alphabetical order, together with brief descriptions and links to relevant topics that contain more information.

KeywordLinkDescription
abstractMembers (F#)

Abstract Classes (F#)
Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation.
andlet Bindings (F#)

Members (F#)

Constraints (F#)
Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters.
asClasses (F#)

Pattern Matching (F#)
Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match.
assertAssertions (F#)Used to verify code during debugging.
baseClasses (F#)

Inheritance (F#)
Used as the name of the base class object.
beginVerbose Syntax (F#)In verbose syntax, indicates the start of a code block.
classClasses (F#)In verbose syntax, indicates the start of a class definition.
defaultMembers (F#)Indicates an implementation of an abstract method; used together with an abstract method declaration to create a virtual method.
delegateDelegates (F#)Used to declare a delegate.
dodo Bindings (F#)

Loops: for...to Expression (F#)

Loops: for...in Expression (F#)

Loops: while...do Expression (F#)
Used in looping constructs or to execute imperative code.
doneVerbose Syntax (F#)In verbose syntax, indicates the end of a block of code in a looping expression.
downcastCasting and Conversions (F#)Used to convert to a type that is lower in the inheritance chain.
downtoLoops: for...to Expression (F#)In a for expression, used when counting in reverse.
elifConditional Expressions: if... then...else (F#)Used in conditional branching. A short form of else if.
elseConditional Expressions: if... then...else (F#)Used in conditional branching.
endStructures (F#)

Discriminated Unions (F#)

Records (F#)

Type Extensions (F#)

Verbose Syntax (F#)
In type definitions and type extensions, indicates the end of a section of member definitions.

In verbose syntax, used to specify the end of a code block that starts with the begin keyword.
exceptionException Handling (F#)

Exception Types (F#)
Used to declare an exception type.
externExternal Functions (F#)Indicates that a declared program element is defined in another binary or assembly.
falsePrimitive Types (F#)Used as a Boolean literal.
finallyExceptions: The try...finally Expression (F#)Used together with try to introduce a block of code that executes regardless of whether an exception occurs.
forLoops: for...to Expression (F#)

Loops: for...in Expression (F#)
Used in looping constructs.
funLambda Expressions: The fun Keyword (F#)Used in lambda expressions, also known as anonymous functions.
functionMatch Expressions (F#)

Lambda Expressions: The fun Keyword (F#)
Used as a shorter alternative to the fun keyword and a match expression in a lambda expression that has pattern matching on a single argument.
globalNamespaces (F#)Used to reference the top-level .NET namespace.
ifConditional Expressions: if... then...else (F#)Used in conditional branching constructs.
inLoops: for...in Expression (F#)

Verbose Syntax (F#)
Used for sequence expressions and, in verbose syntax, to separate expressions from bindings.
inheritInheritance (F#)Used to specify a base class or base interface.
inlineFunctions (F#)

Inline Functions (F#)
Used to indicate a function that should be integrated directly into the caller's code.
interfaceInterfaces (F#)Used to declare and implement interfaces.
internalAccess Control (F#)Used to specify that a member is visible inside an assembly but not outside it.
lazyLazy Computations (F#)Used to specify a computation that is to be performed only when a result is needed.
letlet Bindings (F#)Used to associate, or bind, a name to a value or function.
let!Asynchronous Workflows

Computation Expressions
Used in asynchronous workflows to bind a name to the result of an asynchronous computation, or, in other computation expressions, used to bind a name to a result, which is of the computation type.
matchMatch Expressions (F#)Used to branch by comparing a value to a pattern.
memberMembers (F#)Used to declare a property or method in an object type.
moduleModules (F#)Used to associate a name with a group of related types, values, and functions, to logically separate it from other code.
mutablelet Bindings (F#)Used to declare a variable, that is, a value that can be changed.
namespaceNamespaces (F#)Used to associate a name with a group of related types and modules, to logically separate it from other code.
newConstructors (F#)

Constraints (F#)
Used to declare, define, or invoke a constructor that creates or that can create an object.

Also used in generic parameter constraints to indicate that a type must have a certain constructor.
notSymbol and Operator Reference (F#)

Constraints (F#)
Not actually a keyword. However, not struct in combination is used as a generic parameter constraint.
nullNull Values (F#)

Constraints (F#)
Indicates the absence of an object.

Also used in generic parameter constraints.
ofDiscriminated Unions (F#)

Delegates (F#)

Exception Types (F#)
Used in discriminated unions to indicate the type of categories of values, and in delegate and exception declarations.
openImport Declarations: The open Keyword (F#)Used to make the contents of a namespace or module available without qualification.
orSymbol and Operator Reference (F#)

Constraints (F#)
Used with Boolean conditions as a Boolean or operator. Equivalent to ||.

Also used in member constraints.
overrideMembers (F#)Used to implement a version of an abstract or virtual method that differs from the base version.
privateAccess Control (F#)Restricts access to a member to code in the same type or module.
publicAccess Control (F#)Allows access to a member from outside the type.
recFunctions (F#)Used to indicate that a function is recursive.
returnAsynchronous Workflows (F#)

Computation Expressions (F#)
Used to indicate a value to provide as the result of a computation expression.
return!Computation Expressions

Asynchronous Workflows
Used to indicate a computation expression that, when evaluated, provides the result of the containing computation expression.
selectQuery Expressions (F#)Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context.
staticMembers (F#)Used to indicate a method or property that can be called without an instance of a type, or a value member that is shared among all instances of a type.
structStructures (F#)

Constraints (F#)
Used to declare a structure type.

Also used in generic parameter constraints.

Used for OCaml compatibility in module definitions.
thenConditional Expressions: if... then...else (F#)

Constructors (F#)
Used in conditional expressions.

Also used to perform side effects after object construction.
toLoops: for...to Expression (F#)Used in for loops to indicate a range.
truePrimitive Types (F#)Used as a Boolean literal.
tryExceptions: The try...with Expression (F#)

Exceptions: The try...finally Expression (F#)
Used to introduce a block of code that might generate an exception. Used together with with or finally.
typeF# Types

Classes (F#)

Records (F#)

Structures (F#)

Enumerations (F#)

Discriminated Unions (F#)

Type Abbreviations (F#)

Units of Measure (F#)
Used to declare a class, record, structure, discriminated union, enumeration type, unit of measure, or type abbreviation.
upcastCasting and Conversions (F#)Used to convert to a type that is higher in the inheritance chain.
useResource Management: The use Keyword (F#)Used instead of let for values that require Dispose to be called to free resources.
use!Computation Expressions

Asynchronous Workflows
Used instead of let! in asynchronous workflows and other computation expressions for values that require Dispose to be called to free resources.
valExplicit Fields: The val Keyword (F#)

Signatures (F#)

Members (F#)
Used in a signature to indicate a value, or in a type to declare a member, in limited situations.
voidPrimitive Types (F#)Indicates the .NET void type. Used when interoperating with other .NET languages.
whenConstraints (F#)Used for Boolean conditions (when guards) on pattern matches and to introduce a constraint clause for a generic type parameter.
whileLoops: while...do Expression (F#)Introduces a looping construct.
withMatch Expressions (F#)

Object Expressions (F#)

Copy and Update Record Expressions (F#)

Type Extensions (F#)

Exceptions: The try...with Expression (F#)/>
Used together with the match keyword in pattern matching expressions. Also used in object expressions, record copying expressions, and type extensions to introduce member definitions, and to introduce exception handlers.
yieldSequences (F#)Used in a sequence expression to produce a value for a sequence.
yield!Computation Expressions

Asynchronous Workflows
Used in a computation expression to append the result of a given computation expression to a collection of results for the containing computation expression.

In addition, the following tokens are reserved in F# because they are keywords in the OCaml language:

asrlandlorlsllsrlxormodsig

If you use the --mlcompatibility compiler option, these keywords are available for use as identifiers.

The following tokens are reserved as keywords for future expansion of the F# language:

atomicbreakcheckedcomponentconstconstraintconstructor
continueeagereventexternalfixedfunctorinclude
methodmixinobjectparallelprocessprotectedpure
sealedtailcalltraitvirtualvolatile

See Also

F# Language Reference

Symbol and Operator Reference (F#)

Compiler Options (F#)

© 2016 Microsoft