KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I don't have much PowerShell experience yet and am trying to teach myself as I go along. I'm trying to make some proof of concept code for a bigger project. The main goal here is too dynamically create and add elements to an array using a function. Here is my code: $testArray = @() function addToArray($Item1) { $testArray += $Item1 "###" } $tempArray = "123", "321", "453" $foldertest = "testFolder" foreach($item in $tempArray) { addToArray $item } "###" Every time the function finishes the array becomes empty. Bear in mind most of my programming experience comes from Java, PHP, some C and C++ just to name a few, if I did this in PHP (adjusting the language syntax of course) this would have worked fine.
Tags (comma-separated)
Save Edits
Cancel