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

Literals

Literals are the simplest form of expressions. In this section, we will look at some literals.

test

5; // Scalar literal
4.0mm; // Quantity literal
"Hello"; // String literal

There are several types of literals:

NameEncodingDescription
Integer64 bit integersigned integer
Scalar64 bit floatsigned floating point
Boolean1 bit boolboolean
StringUTF-8Text
Quantities64 bit floatsigned floating point (including type)

Integer Literals

Integer literals contain a whole number with a sign (but without a unit). Here are a few examples:

test

50;
1350;
-6

Scalar Literals

Scalar literals contain a floating point number with a sign (but without a unit).

test

1.23;
0.3252;
.4534;
1.;
-1200.0;
12.0E+12;
50% // = 0.5

Boolean Literals

Booleans contain either the value true or false:

test

true;
false

String Literals

Strings are texts enclosed in quotation marks:

test

"Hello, World!"

Quantity Literals

Quantities are like scalars but with a unit and are widely used in microcad if you wanna draw something.

test

4.0mm; // 4 millimeters
5l; // 5 liters
4m²; // 4 square meters
4m2; // also 4 square meters
10°; // 10 degree angle
10deg // also 10 degree angle

You will find more details about quantities and units in this section.