• No categories

Data Types

Every programming language needs a way to construct complex, structured data types. This section introduces the constructs available for doing this in Whiley.

  1. Primitives – Whiley’s main primitives are int, real, bool and null.
  2. Lists – Whiley provides lists, e.g.  [1,2,3], and ls[i].
  3. Sets – Whiley provides sets, e.g. {1,2,3}.
  4. Maps – Whiley provides maps, e.g. {1=>"Hello World"}.
  5. Tuples – Whiley provides tuples, e.g. (1,2) is a tuple.
  6. Records – Whiley provides records, e.g. {input: "test", pos: 0}.
  7. Functions – Whiley provides first-class functions.

An important difference from other languages is that Whiley permits the user to write constraints on types (see this page for more).