KCL supports the usual arithmetic operators on numbers and logic operators on booleans:

OperatorMeaning
+Addition
-Subtraction or unary negation
*Multiplication
/Division
%Modulus aka remainder
^Power, e.g., x ^ 2 means x squared
&Logical 'and'
``
!Unary logical 'not'

KCL also supports comparsion operators which operate on numbers and produce booleans:

OperatorMeaning
==Equal
!=Not equal
<Less than
>Greater than
<=Less than or equal
>=Greater than or equal

Arithmetics and logic expressions can be arbitrairly combined with the usual rules of associativity and precedence, e.g.,

myMathExpression = 3 + 1 * 2 / 3 - 7

You can also nest expressions in parenthesis:

myMathExpression = 3 + (1 * 2 / (3 - 7))

KCL numbers are implemented using floating point numbers. This means that there are occasionally representation and rounding issues, and some oddities such as supporting positive and negative zero.

Some operators can be applied to other types:

  • + can be used to concatenate strings, e.g., 'hello' + ' ' + 'world!'
  • Unary - can be used with planes or line-like objects such as axes to produce an object with opposite orientation, e.g., -XY is a plain which is aligned with XY but whose normal aligns with the negative Z axis.
  • The following operators can be used with solids as shorthand for CSG operations: