Skip to content

Syntax & Variables

Tulpar supports the following data types:

TypeDescriptionExample
intInteger numbersint x = 42;
floatFloating-point numbersfloat pi = 3.14;
strUTF-8 stringsstr name = "Hamza";
boolBoolean valuesbool flag = true;
arrayMixed-type arraysarray mix = [1, "text", 3.14];
arrayIntType-safe integer arraysarrayInt nums = [1, 2, 3];
arrayFloatType-safe float arraysarrayFloat vals = [1.5, 2.5];
arrayStrType-safe string arraysarrayStr names = ["Ali", "Veli"];
arrayBoolType-safe boolean arraysarrayBool flags = [true, false];
arrayJsonJSON-like objectsarrayJson obj = {"key": "value"};

Variables are declared with their type:

// Variable declaration
int x = 10;
float y = 3.14;
str name = "TulparLang";
bool active = true;
// Compound assignment
x += 5; // x = 15
x *= 2; // x = 30
// Increment/Decrement
x++; // x = 31
x--; // x = 30

Tulpar supports single-line and multi-line comments:

// Single-line comment
/*
Multi-line
block comment
*/