Let’s see implementation of For Each Loop Let’s see its usage with the help of a Simple Example: This works in the same manner as the above but the implementation is slightly different. When you want to repeat the code for each index value of an array then you can use ‘For Each Loop’. Again the same process will go on and this will last for 4 times as the range is from 1 to 4.Įach Loop is an extension of For Loop.The counter will be increased by 1 using the ‘Next’ keyword.The statement inside the loop is executed adjoining with the value of the variable.‘For Loop’ is starting with a counter value (which we are defining with the variable name ‘var’) of 1 and this will repeat 4 times as the counter is from 1 to 4. Let’s understand the working of the code: there is some fixed number of times/fixed iteration count to perform a condition.Įxample to show the usage of ‘For Loop’ is as follows: This is used in those scenarios where you know the fixed number of times for executing the statements in a code i.e. This is the most basic and widely used loop. These types further include some other loops as well. There are several types of Loops in the VBScript that can be used under various scenarios based on the requirements of a code.īroadly, there are 3 types of loops in the VBScript, which are as follows: Let’s move to the different types of loops that are supported by VBScript. The syntax of the loop will be as follows: If you want to send an invitation to 10 people with the same message then you can use ‘for loop’ in this case as a counter is fixed and you know the message which is to be repeated 10 times. Let me take a simple example to explain the concept easily. Whenever repetitions of some particular statements are required in the code then loops are used until the condition is fulfilled. In the same way, Loops in the VBScript means those statements in the code which can be repeated several times until any particular condition reaches to an end.Ī sequence is followed while using a loop and the statement which comes at the beginning of the code is executed first and so on. Generally, Loop means to repeat something several times. Different types of Loops in the VBScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |