Explain Tokens, Keywords, and comments in the F# Language | F# Tutorial
Explaining Tokens, Keywords, and comments in the F# Programming Language
In this article, you will understand the basic terminology of the F# language.
Tokens in F# Programming:
F# programming language has multiple tokens. A token can be a keyword, an identifier, a string literal, a constant, or a symbol. The token in F# is of two types:
- Keywords
- Strings and Literals.
Keywords in F# Programming
Keywords are words whose meaning is pre-defined in the programming language. It can not be used as variables and literals. The keywords used in the F# are:
Keywords with their description
- abstract
It indicates that either the method is not implemented in the type it is declared or it is virtual and not implemented anywhere.
- and
It is especially used in mutually recursive bindings, declaration in property, and with various constraints in generic parameters.
- as
It is used in giving the name of the present class object to an object name. It is also used in giving the name to an entire pattern inside the pattern match.
- assert
It is used to verify the code after performing debugging.
- base
It is used as a name for the present class object.
- begin
It indicates the start of the code.
- class
The definition of the class starts from this word.
- default
It defines the indication of an abstract method. It can be used with an abstract method declaration to create a virtual method.
- delegate
It is used in the declaration of the delegate.
- do
It is used in looping constructs or to execute vital code.
- done
It points to the end of the code in a looping expression.
- downcast
It is used to convert to a type that is lower in the inheritance chain.
- elif
It is used in conditional formatting.
- else
It is used in conditional branching.
- exception
It is used in exception declaration.
- false
It is used in a boolean literal.
- finally
It executes the block of code regardless of whether the output of the exception is true or false.
- for
It is looping branching.
- function
It is used in the shorter alternative to the fun keyword.
- if
It is used in conditional formatting.
- interface
It is used in declaring and implementing interfaces.
- member
It is used as a property and method in an object type.
- private
It restricts the access to a member to code in the same type.
- public
It allows access to a member from outside the type.
Comments in F# programming language
It has two types of comments:
- One Line comment: It is represented by using the// symbol.
- Multi-Line comment: It starts with * and ends with *.