Assignment Statements in DIAL

Assignment statements attach an expression to a variable. An assignment statement has the following form:

variable = expression;

where variable refers to a script variable and expression is a standard DIAL expression. The expression is evaluated, and the return value is assigned to the specified variable.

Example 1:

x = "purple";
y = (m * z) + c;

If m is 3, z is 15, and c is 2, the value of y is set to 47.

 

Example 2:

testname = "demo_drs.dbk";

The variable testname is assigned the DiveBook file name, demo_drs.dbk. Now, the variable can be used to replace this file name in a script. For instance:

countvariable = divebook.area_count(testname);
last_area_name = divebook.area_name(testname,countvariable);

 

NOTE: Make sure not to confuse an assignment statement (=) with the comparison operator (==). If (=) is used instead of (==), an assignment is made, and any comparison is true.