Partager via


Primitive Types (F#)

This topic lists the fundamental primitive types that are used in the F# language. It also provides the corresponding .NET types and the minimum and maximum values for each type.

Summary of Primitive Types

The following table summarizes the properties of the primitive F# types.

Type

.NET type

Description

bool

Boolean

Possible values are true and false.

byte

Byte

Values from 0 to 255.

sbyte

SByte

Values from -128 to 127.

int16

Int16

Values from -32768 to 32767.

uint16

UInt16

Values from 0 to 65535.

int

Int32

Values from -2,147,483,648 to 2,147,483,647.

uint32

UInt32

Values from 0 to 4,294,967,295.

int64

Int64

Values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

uint64

UInt64

Values from 0 to 18,446,744,073,709,551,615.

nativeint

IntPtr

A native pointer as a signed integer.

unativeint

UIntPtr

A native pointer as an unsigned integer.

char

Char

Unicode character values.

string

String

Unicode text.

decimal

Decimal

A floating point data type that has at least 28 significant digits.

unit

not applicable

Indicates the absence of an actual value. The type has only one formal value, which is denoted (). The unit value, (), is often used as a placeholder where a value is needed but no real value is available or makes sense.

void

Void

Indicates no type or value.

float32, single

Single

A 32-bit floating point type.

float, double

Double

A 64-bit floating point type.

Note

You can perform computations with integers too big for the 64-bit integer type by using the bigint type. bigint is not considered a primitive type; it is an abbreviation for BigInteger.

See Also

Other Resources

F# Language Reference