'how do I make this repeat so many times

how would I make this repeat so many time example like 2 times I understand how to make a powershell command repeat but not a powershell script

webHookUrl = 'discord webhook'
[System.Collections.ArrayList]$embedArray = @()
$title       = ''
$description = 'pov bean'
$color       = '255'
#ignore this its just a bean
$imageUrl = 'https://media.discordapp.net/attachments/922271992890142781/929942952501981265/9ca3a0b4352ca3ff74b89cb208ceda6ab5-kidney-bean.png?width=1005&height=670' 
$imageObject = [PSCustomObject]@{
    url = $imageUrl
}
$embedObject = [PSCustomObject]@{
    title       = $title
    description = $description
    color       = $color
    thumbnail   = $imageObject
}
$embedArray.Add($embedObject) | Out-Null
$payload = [PSCustomObject]@{
    embeds = $embedArray
}
Invoke-RestMethod -Uri $webHookUrl -Body ($payload | ConvertTo-Json -Depth 4) -Method Post -ContentType 'application/json'

did

For ($i = 0; $i -lt 5; $i++) {
    Write-Output $i
}

the 5 is the amount i want it to repeat and well that worked



Solution 1:[1]

If your goal is to make a powershell script repeat, maybe this might help how to loop my powershell script?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mathusan.P