--- title: "Defining Variables" slug: "defining-variables" updated: 2024-01-30T16:44:25Z published: 2024-01-30T16:44:25Z canonical: "kb.dataparc.com/defining-variables" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.dataparc.com/llms.txt > Use this file to discover all available pages before exploring further. # Defining Variables ### Dim Variable names that are used in calculations must be defined. For normal calculations, the variables are defined as: Dim NewValue as Single The variable name is “NewValue”. Example code is: Dim NewValue as single ‘Sum Input tags 3, 5 and 9 and place in Output tag 4 NewValue = GD(3) + GD(4) + GD(9) Tag(4, NewValue) ### Static Variable names that are used for doing calculations must be defined. Normally they are defined with the Dim statement. Each time the routine is executed, the number is zeroed. To keep the value between iterations, define the variable using **Static** as follows: Static OldValue as Single The variable name is “OldValue”. Example code is: Dim NewValue as single Static OldValue as single ‘Sum Input tags 3, 5 and 9 and place in Output tag 4 NewValue = GD(3) + GD(4) + GD(9) If OldValue <> NewValue then Tag(4, NewValue) End If OldValue = NewValue