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.

Multiway branching

Sometimes it is necessary to examine the condition so that, depending on the result value, program offers multiple alternative actions. In this case, the Select-Case structure for multiway branching is used. It works by sending a parameter to it and, depending on its value, different parts of the program are executed. If the parameter value differs from all the alternatives offered the program code behind Else command is executed.

Checking the logical condition

Checking the logical condition is done using the If-Then-Else structure. It starts with the command If, followed by a logical condition that is formed in the same way as in Excel. Next follows the command Then, aftwer which goes the part of the code to be executed if the condition is met. Optionally, Else command can be specified, followed by a part of the code that is executed if the condition is not met. The structure ends with an End If command, which is not necessary if there’s only one command after Then.