Jump to content
Vaindam

For Loop

Recommended Posts

Vaindam

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

Example:

$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
JLogan3o13

@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)
    Next

Edit: Also moved to correct forum

Edited by JLogan3o13

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

How to get your question answered on this forum!

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

×