Jump to content

For Loop

Recommended Posts


How can I loop from variable to 1 with step -1


$HCount = ClipGet()

For $i = $HCount to 1 Step -1

I have tried above but it is not working. Please help me.

Share this post

Link to post
Share on other sites

@Vaindam please post your whole code, as it appears you have some logic issues. This, for example, works just fine.

Local $aArray[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
ClipPut(UBound($aArray) - 1)
Local $sVal = ClipGet()
    For $i = $sVal To 0 Step -1
        ConsoleWrite($aArray[$i] & @CRLF)

Edit: Also moved to correct forum

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.