Data Types

Tenet is dynamically typed. Values have types; variables do not.


Numbers

All numbers are 64-bit floating point (IEEE 754 double precision).

var x = 42;        // Integer
var pi = 3.14159;  // Decimal
var neg = -17.5;   // Negative
Note: Scientific notation (e.g., 1.5e10) is not yet supported.

Strings

Strings are enclosed in double quotes. Single quotes are not supported.

var greeting = "Hello, World!";
var empty = "";
var multiword = "Game Theory DSL";

String Concatenation

Use + to join strings:

var full = "Hello, " + "World!";
print full;  // Hello, World!

Booleans

Two boolean literals: true and false.

var yes = true;
var no = false;

Truthiness

When used in conditionals:

  • false and nil are falsy
  • Everything else is truthy (including 0 and "")
if (0) {
    print "zero is truthy";  // This runs!
}

Nil

The absence of a value.

var nothing = nil;
var uninitialized;  // Also nil

Type Summary

TypeExamplesDescription
Number42, 3.14, -564-bit floating point
String"hello", ""Text in double quotes
Booleantrue, falseLogical values
NilnilAbsence of value

Next Steps