/
The .if function creates a conditional statement:
Boolean to evaluate..if {yes}
Hello, Quarkdown!Hello, Quarkdown!
The function returns the lambda’s result if the condition is satisfied, or nothing otherwise. This means the function propagates its content up the call stack.
<!-- Read this from bottom to top -->
.if {yes}
.if {no}
.if {yes}
.if {yes}
Hello!This behavior lets you use the function as part of any expression. For example, you can use it to conditionally include content inside layout functions, such as stacks.
.row gap:{1cm}
A
.if {.iseven {3}}
B
CA
C
The .ifnot function is a shorthand that inverts .if’s behavior, returning a value only if the condition is not satisfied.
Quarkdown does not yet have an else statement, but you can emulate one using the .let function:
.let {.iseven {3}}
condition:
.if {.condition}
3 is even!
.ifnot {.condition}
3 is odd!3 is odd!
.ifnot {.condition}is equivalent to.if {.condition::not}