Arrays in windows powershell scripting

We can create arrays using below syntax.
 
$cities = @(“Brisbane”,”Perth”,”Sydney”)

Use below syntax to access first element in an array.
 
echo $cities[0]

Use below syntax to access last element in an array.
 
echo $cities[-1]

To add an element in an array, you can use below command.
 
$cities = $cities + “Hobart”

Below image shows how you can work with arrays in Windows Powershell.

Web development and Automation testing

solutions delivered!!