Expressions
Expressions let Jess evaluate values explicitly.
Write an expression as $(...).
$varis a variableReference(not anExpression).$(...)is anExpression.
Inside an expression, keep variable references explicit: $($var).
Examples
Basic arithmetic
value: $(1 + 2); // 3
value: $(1 - 2); // -1
value: $(1 * 2); // 2
value: $(1 / 2); // 0.5
value: $(1 % 2); // 1 (modulus)
CSS values
value: $(#222 / 2); // #111
Jess variables
$width: 10px;
$height: $($width + 10px);
#header {
width: $width;
height: $height;
}
References vs expressions
Inside an expression, a plain identifier is a value or keyword. A variable still
uses its $ sigil.
$color: red;
value: $(red); // red (color keyword literal)
value: $($color); // red (variable reference inside Expression)
value: $less.iscolor($color); // true
$num: 10;
value: $($num + 1); // 11
Arithmetic is explicit
Keep arithmetic inside the expression wrapper:
$w: 10px;
width: $($w + 1px);
Use a variable reference inside the expression. Do not write unwrapped arithmetic
such as $w + 1px.