Expressions
The HCL has some unique expressions to handle complex scenarios such as conditional logic, referencing dynamic types, and iterating nested blocks. We will learn about these final language structures before we delve into the library of functions available to us within the language.
Conditional expressions
In other languages, this technique is called a ternary conditional operator—namely, of the imperative variety. That’s fancy talk for an if
statement in HCL. Typically, an if
block spans multiple lines of code and uses some method for scoping the two conditions:
if (x == 5) { // do something } else { // do something else }
This classic example shows how a conditional statement manifests in an imperative language. The curly brackets provide scope for the code that the computer will execute when the Boolean...