Looking to use ForEach
here specifically.
reading in and loading a csv
file for sample data:
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> $a = Import-Csv -Path ./alphabet.csv
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> $a[7].psobject.Properties.name
symbol
code word
morse code
phonetic
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> $a[7].'code word'
Hotel
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> $a.'code word'
Alfa/Alpha
Bravo
Charlie
Delta
Echo
Foxtrot
Golf
Hotel
India
Juliett
Kilo
..
Yankee
Zulu
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> $numbers=(1,2,3,4,5)
PS /home/nicholas/powershell/regex>
PS /home/nicholas/powershell/regex> foreach ($number in $numbers){ echo $number}
1
2
3
4
5
PS /home/nicholas/powershell/regex>
but how would foreach
be used to iterate through each row? Something like:
$a.forEach($code_word in $a.'code word'){echo $code_word}
looking to use ForEach
here specifically, preferably in one-line which can be used in the REPL console.