Spec-Zone.ru › OCaml
☰The OCaml language
  • The OCaml language
  • Language extensions

Chapter 11 The OCaml language

5 Constants

constant ::= integer-literal
∣ int32-literal
∣ int64-literal
∣ nativeint-literal
∣ float-literal
∣ char-literal
∣ string-literal
∣ constr
∣ false
∣ true
∣ ()
∣ begin end
∣ []
∣ [||]
∣ `tag-name

See also the following language extension: extension literals.

The syntactic class of constants comprises literals from the four base types (integers, floating-point numbers, characters, character strings), the integer variants, and constant constructors from both normal and polymorphic variants, as well as the special constants false, true, (), [], and [||], which behave like constant constructors, and begin end, which is equivalent to ().

« Type expressionsPatterns »
Copyright © 2026 Institut National de Recherche en Informatique et en Automatique

© 1995-2026 INRIA.
https://ocaml.org/manual/5.5/const.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API