Base Properties of a Variable

At a minimum, all variables must have the following defined:

Name: A string used to refer to a variable. It is necessary to use this variable inside other expressions (such the valorization of a Text Field or the computation of another variable). To refer to a variable the following syntax is used: $V{variable_name}.
Type: Necessary because a variable is an object that probably is used in other expressions, so its type must be known to be manipulated correctly.
Expression: The function used to define the variable value, it can be composed of more fields and variables, and could be logic operators, math operators and so on. To easily define the expression an expression editor is provided in Jaspersoft Studio. This can be opened using the button to the right of the text Field used to write the expression. The expression is evaluated on each iteration, every time a record is read from the data source. If there isn't a calculation function defined, the result of the expression is assigned to the variable. Thus it's important that the result has a type compatible with the one in the variable.
Initial Value: The value assumed from the variable at the beginning, before the first computation of its expression. The initial value is an expression itself, so it can be defined through the expression editor. It's not mandatory, but it is good practice to define an initial value. For example, if you have a variable called variable1 with the expression new Integer(5). At every record read, the variable is assigned the integer value 5, so the initial value it isn't important in this context. However, if you change the expression to $V{variable1}+5, at every iteration the variable is incremented by 5. In this case, an initial value is necessary because if at the first iteration the variable1 is undefined, all future evaluations will break. So while an initial value is not mandatory, but undefined variables can be dangerous.