if(criteria) Last updated: 17. Oct 2026
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
| Name | Type | Description |
|---|---|---|
| criteria | bool | Bool statement or value to evaluate. |
Returns
Nothing
Example
Data
{
"value1" : true,
"value2" : false
} Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.#if(value1) {#
<b>If condition content</b>
#} else {#
<i>Else content</i>
#}# Output
The #JS code above produces the output shown below:<b>If condition content</b>
Code example (JS)
JS is normal JavaScript either 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"); Output
The JS code above produces the output shown below:Test 1: true
Test 2: false