Iterating over an Array
Iterating over an array is achieved using for loop. Using for loop, we can access elements one by one. Let us look at the example below. /l is used here, as we move through the specified range and iterate through the Array.
@echo off set a[0]=5 set a[1]=7 set a[2]=9 Rem Adding a new element at the array end Set a[3]=12 echo The last element is %a[3]%
The Above snippets produce the below Output
Download Upload Browse Add Save Delete
Batch Script – Arrays
An array is a collection of elements of the same data type. The arrays are not explicitly defined as Batch Script types but can be used. The following items need to be noted when the same members are used in Batch Script.
- Each aspect of the same members needs to be defined by a set order.
- A ‘for’ loop will be required to double the program values.
Contact Us