Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Primitive Types

Bool

Boolean is the result type of boolean expressions, which may be true or false.

test

std::debug::assert(true != false);

Boolean values can be combined with or and and operators:

test

std::debug::assert_eq([true or false, true]);
std::debug::assert_eq([true and false, false]);

std::debug::assert_eq([4 == 4, true]);
std::debug::assert_eq([4 == 5, false]);
std::debug::assert_eq([4 == 5 or 4 == 4, true]);
std::debug::assert_eq([4 == 5 and 4 == 4, false]);

Integer

The type Integer contains an integer number.

test

i = 3;

String

Strings are mostly used for rendering text.

test

text = "Hello µcad!";
std::debug::assert_eq([std::string::len(text), 11]);

// logging
std::print(text);

Matrix

Matrix types are built-in types and can be defined as:

  • Matrix2: A 2x2 matrix, commonly used for 2D rotations.
  • Matrix3: A 3x3 matrix, commonly used for rotations.
  • Matrix4: A 4x4 matrix, commonly used for affine transformations.

Note: Currently, matrices are used only internally and cannot be instantiated from µcad code.