Function Keyword Updated 31 May 2023
else
For use in if statements, runs code statement or block if criteria evaluates to "false".
Parameters
This function takes no parameters.
Returns
nothing
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#if (value1 == "abcd") {#
value1 is abcd
#} else {#
value1 is NOT abcd
#}#The template above produces this output:
value1 is NOT abcd
Normal JavaScript, running in the browser or on the Docly™ server.
var value1 = "testing";
if (value1 == "abcd") /* this criteria will evaluate to false */
write("value1 is abcd"); /* therefore this will not run */
else
write("value1 is NOT abcd"); /* instead this will run */The JavaScript above produces this output:
value1 is NOT abcdThe data the example runs with:
{
"value1" : "testing"
}