Liking cljdoc? Tell your friends :D

Math and Logics

It is possible to embed complex mathematical equations and logical formulae in the document logic.

Simple math

  • Use of integers and floating point decimals are supported.
  • Use of parentheses in expressions is supported. For example: { %=(x.price * (1 + x.tax_pct))% }
  • The following mathematical algebraic operators are supported: +, -, *, /, %.
operatorsymbolexamplemeaning
addition+a + bsum of a and b
subtraction-a - b, x-1value of a minus b
multiplication*a*bvalue of a multiplied by b
division/a/bvalue of a divided by b
modulo%a%bremainder of a after divided by b

Logics in conditions

You can use logical operators in the expressions. These are useful inside conditional expressions.

operatorsymbolexamplemeaning
conjuction (and)&a & bboth a and b are not null and not false values
disjunction (or)|a|beither a or b or both are not null or false
negation (not)!!avalue a is false or null

Function calls

There are simple functions you can call from within the template documents. Read more on the Functions documentation

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close