Basics | Variables & Arrays
So to specify something as a variable just start it with a $
I also wanted to bring up using object oriented access to properties in-line with text. You have to add the extra $ and () around the variable as shown in the example below.
Special Note: Be aware there is casting of variables so that data is what you want it to be.
This can only accept a integer:
This casts the data as an INT but not the variable so the
$SomeVar can be reassigned to a value and accept a string.
$SomeVar = [int]1234
For More Information
Working with arrays is a very common occurrence in programming so get used to it.
Using $MyVar as a variable or declaring $MyVar=@() as an array provide very different results.
I have ran into issues alot when I use a foreach loop on an variable and its format is not correct. As soon as I declare the variable as an array and get the input; my foreach loop works as perdicted.
Below I append using the += operator to combine the two arrays of data.
You can also use special operator (Count) utilized in an obeject oriented syntax, for things like getting the total count of items in the array.