Resize an array

Hi there
I am trying to use a function I found few months ago that will resize an array into pieces so I can do all kind of stuff with it “chunks” like jobs or schedule each chunk
its probably some small mistake I am doing but I don’t see it breaking it into chunks.
something like this:
function Resize-Array ([object]$InputObject, [int]$SplitSize = 100)
{
$length = $InputObject.Length
for ($Index = 0; $Index -lt $length; $Index += $SplitSize)
{
, ($InputObject[$index … ($index + $splitSize - 1)])
}
}
$numbers=@()
$numbers= 1…300
$SplitSize = $numbers.Count/10
$resizedarray=Resize-Array -InputObject $numbers -SplitSize $splitsize

any help would be appreciated
Thanks

Sorry, too late at the day to post stupid questions:)
was working fine
I forgot, I was listing
$resizedarray
instead of $resizedarray.count which has exactly the expected “groups”
or $resizedarray[0] which has the first “group”
oh well

small little question about that
if I do something like this:
function Resize-Array ([object]$InputObject, [int]$SplitSize = 100)
{
$length = $InputObject.Length
for ($Index = 0; $Index -lt $length; $Index += $SplitSize)
{
, ($InputObject[$index … ($index + $splitSize - 1)])
}
}

$numbers= (1…300)
$SplitSize = $numbers.Count/10
$resizedarray=Resize-Array -InputObject $numbers -SplitSize $splitsize
foreach ($array in $resizedarray){
Write-host “$array” -ForegroundColor Green
Start-Sleep -Seconds 10
}

I get something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60…

what if I wanted to write-host every item in that sub array like this:
1
2
3
4
5

how would I access the items in each of these “sub groups”
Thanks

Well, why dont you try “Write-Output” instead?

“Write-Output” returns objects.

“Write-Host” doesn’t return any objects.

See the help for both of the commands for further explanation.

/Alexander

Thanks
I had two silly questions in one day:)
all I needed was another foreach and its good to go:)
but thanks for your reply I learned something new