Variable scope and lifetime

The variable, after declaration, has its own lifespan and it lasts until the subroutine in which it was created is completed. Sometimes we want her to keep its value even after leaving the subroutine. Also, the variable is visible only within the module in which the it is located. Is there a need for it to be seen outside the module? How to define the range and extend the life span of variables will be found in the text that follows.

Dynamic arrays

Sometimes we need to make an array that we are not sure of how many members will have. In this case should create dynamic arrays that, unlike the usual ones, do not have a fixed length. These arrays are declared in such a way that the number of members is omitted, and how many of them will be, or for how long the number of members of array should be increased is subsequently defined with commands that will be discussed in the text that follows.

Arrays

Arrays represent a group of variables of the same type. Since they often contain values that share common attributes, it is easier for us to assign them a unique name, and then to access each of them with an index number in a array. The index of the first member of an array is usually 0, and the index of the last one is smaller for one than the size of the array. It is possible to work with a whole array or with its individual members, they can be one or multi-dimensional …

Do Loop structure

Do-Loop structure, unlike For-Next loops, does not have built-in counter, for this purpose we have to declare one integer variable. Its value is increased in the loop body before or after the given statements, and checking the conditions on which it comes out of the loop is performed, in the case of the Do-While loop, at the beginning and in the case of the Do-Until loop at the end. Let’s see how to use these loops!

For-Next loop

Loops are structures that are used if we want to repeatedly execute given program code. The easiest to understand and probably most often used is the For-Next Loop. It is used when we know exactly how many times we want to repeat a particular action. First, the initial and the end value are set; we can also set the optional Step value for which counter is being incremented. Further we enter the programme code and in the end Next statement and a counter name.