There are two types of blocks, the functional blocks and the function blocks, their variables are declared differently:
Function Block - These are the blocks that have an instance and it must be declared in the Structured Text.
Ex:

Figure 1: Declaration of the variables and the instance of the Counter Up block
Functional Block - These are the blocks that have no instance.
Ex:

Figure 2: Declaration of the Equal Comparison block variables