Knowledge Base Article

## Using the Constant Algorithm Tab

In the Constant Editor, go to the Algorithm Tab.  The Algorithm Tab is the primary programming user interface for coding a vCalc constant.  vCalc currently uses the Groovy programming language with a few vCalc specific additions.  For general information on Groovy, see  groovy-lang.org.  For examples of Groovy in vCalc, you can always look at the Algorithm of any existing vCalc constant within the constant's wiki page by selecting "See Algorithm" at the bottom.  You can also see the standard Groovy syntax used in vCalc by clicking HERE.

There are two sections to the constant's Algorithm Tab:  the Coding Window (top left), and the Equations and Constants Window (right).                             Coding Window

### Coding your Constant

Within the Algorithm Tab, you will see the Coding Window.  It is a blank section with line numbers down the left side.  Click inside the window to enter your vCalc (Groovy) code.
Note: For security purposes, vCalc precludes global variables and all variables must be defined locally with the def statement.

In the enclosed example, where the constant named MySlice is equal to (3 pi)/4.   This is a simple numeric constant without units or an algorithm.  However, vCalc provides a mechanism for both units and constants to be calculated (e.g. the result of an equation).  See using an EiC or CiC (Equation in a Constant and Constant in a Constant). See Help with Units for the syntax of creating a constant with units (e.g. (3 pi)/4 radians).