Jade Node.js Template Engine, Conditional Logic Statements

In my previous post I have talked about databinding with jade, i.e. feeding data to your template. In this post I will write about how one can use conditional and logical statements (for, if, while statements) in jade template engine.

Ternary Operation

The conditional ternary operator can be applied in Jade as follow ( ? : )

Conditional Statements

Jade has built in (if, else statements, and also provides the unless statement)

Case statements

The case statement is more of a shorthand for the switch statement in Jade.

Iterators

Jade provides (for, each, while as loops)

In my next post I will write about mixins and filters for Jade.