Book Image

VMware vRealize Orchestrator Essentials

By : Daniel Langenhan
Book Image

VMware vRealize Orchestrator Essentials

By: Daniel Langenhan

Overview of this book

Table of Contents (18 chapters)
VMware vRealize Orchestrator Essentials
Credits
Foreword
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The if-clause in JavaScript


The if-clause is equivalent to the Decision element that we used in the last chapter. It checks whether a condition has been met.

The JavaScript code for an if statement isn't that difficult. It is made up of a condition and the if-clause itself. The form looks like this:

Statement

Example

if (condition) {
    code block
} else if (condition) {
    code block
} else {
    code block
}
if (varString == "test") {
    varResult=true;
} else {
    varResult=false;
}

In the preceding example, the varString string is tested if it contains the word "test". If it does, the Boolean varResult is set to true. If it is not (the else part), it is set to false. The else if block can be added multiple times.

Conditions and operators

A condition is made up of a statement that is either true or false. This statement is built by using operators. The following are the operators that JavaScript knows:

and

or

Not

Equal

Not equal

Smaller

Bigger

&&

||

!

==

!=

&lt...