Numeric Variables

Variables provide temporary storage for numerical quantities whose exact value may not be known when the macro is written, but is defined when the macro is run. OpticStudio performs most of the work for you when you need a new variable. For example, the command

x = 5

will cause OpticStudio to allocate memory for the new variable "x" and keep track of the value associated with it. Once the variable is defined, it may be used in any subsequent expression. There are a few rules regarding ZPL variables:

Variable names must not contain any "special" characters that ZPL uses for logical operations or delimiting such as (, ), =, +, -, *, /, !, >, <, ^, &, |, #, ", and the space character.

A variable cannot take on the same name as a keyword or function, such as THIC or RAYX. Since ZPL is not case-sensitive, you cannot use rayX or Thic to avoid this rule.

Each variable name is limited to 28 characters.

All ZPL numeric variables are stored internally as 64-bit double precision numbers.

Next: