Function Updated 17 Oct 2026
if(criteria)
Evaluates a condition and runs code if it is true. The condition uses standard JavaScript truthiness: false, 0, NaN, "" (empty text), null and undefined are false; everything else — including "0", "false", [] and — is true.
Parameters
criteriaboolrequiredBool statement or value to evaluate.
Returns
Nothing
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#if(value1) {#
<b>If condition content</b>
#} else {#
<i>Else content</i>
#}#The template above produces this output:
<b>If condition content</b>
Normal JavaScript, running in the browser or on the Docly™ server.
write("Test 1: ");
if(value1) write("true");
write("\r\r");
write("Test 2: ");
if (value2) write("true"); else write("false");The JavaScript above produces this output:
Test 1: true
Test 2: falseThe data the example runs with:
{
"value1" : true,
"value2" : false
}