Expressions are JavaScript phrases that are evaluated to yield a value. JavaScript statements execute commands or combine one or more expressions to do things or yield values. A JavaScript program is a collection of statements.
This section briefly describes variable declaration and variable assignment, iterations, and loops that are commonly used in CA Process Automation calculations. The following table lists JavaScript statements, some of which are not documented in this section.
JavaScript Statements
|
Statement |
Syntax |
Description |
|---|---|---|
|
break |
break; break label_name: |
Exit from a switch or iterative statement; or exit from the statement named by a label statement. |
|
case |
case expression: |
Labels a statement within a switch statement. |
|
continue |
continue; continue label_name: |
Restart the loop, or the loop named by a label statement. |
|
default |
default; |
Label the default statement within a switch statement. |
|
do/while |
do statement while (expression) |
Perform expressions in a while statement until an expression evaluates False. |
|
empty |
; |
Do nothing. |
|
for |
for (initialize ; test ; increment) statement |
Loop while a test is True. |
|
for/in |
for (variable_in_object) statement Loop through properties of an object. |
See “The for/in Loop Statement." |
|
function |
function function_name(a1,a2,...an) {statements} |
Declares a function. See “Include Common Resources in CA Process Automation Scripts” . |
|
if/else |
if (expression) statement1 else statement2 |
Execute conditionally. See “The if Statement.” |
|
label |
identifier: statement |
Assign an identifier to a statement. |
|
return |
return[ expression]; |
Return from a function or return a value from a function. |
|
switch |
switch (expression) { statements } |
Multiway conditional branch to case or default statements. See “The switch Statement.” |
|
throw |
throw expression; |
Throw an exception. |
|
try |
try { statements } |
Catch an exception. |
|
var |
var name_1[=value1][, ..., name_n [=value_n]]; |
Declare and optionally initialize variables. See “Variable Declaration.” |
|
while |
while (expression) statement |
Perform expressions in a while statement while an expression evaluates True. See “The while Loop Statement.” |
|
Copyright © 2014 CA.
All rights reserved.
|
|