First of all: Happy new year 2022 retroactively!
My question:
I have a simple loop:
Clear host
$example = 5
$data = " is OK Output: "
for($i = $example; $i -gt 0; $i--)
{
write-host $i$data
}
#-----
5 is OK Output:
4 is OK Output:
3 is OK Output:
2 is OK Output:
1 is OK Output:
And a second loop:
$example = 5
$number1 = 25
for($i = $example; $i -gt 0; $i--)
{
$number1 - 5 * $i
}
#-----
0
5
10
15
20
How do you get this output with one loop?
5 is OK Output: 20
4 is OK Output: 15
3 is OK Output: 10
2 is OK Output: 5
1 is OK Output: 0
Unfortunately I can’t find the solution, and I hope someone can please help me. Thank you.