var / endvar

var assigns an array, an object, or a function to a variable whose value and fields can be accessed with a placeholder.
If the var assignment on is one line, closing with the endvar command is not required.

for / endfor

Iterates over a list (created with the list command), an array (declared with the var command or specified inline), or variable properties.
To access the current element use the @{elementname} placeholder syntax, or in simple cases, @elementname.
Multiple for or endfor loops can be nested.

if / elseif / else / endif

Evaluates an expression and prints out settings if the expression is true.
If the expression returns false, content located within the branch is excluded from the widget configuration.
Array elements are accessed in the if or elseif expression by name, not as a placeholder.

Troubleshooting

To review the final configuration text after pre-processing, add the script = console.log(widgetConfig) anywhere in the widget configuration and review the text in Developer Console (F12) -> Console tab.