Sign in to follow this  
Followers 0
Champak

If Loop Errors

5 posts in this topic

I'm trying to do a loop based on a condition without forming 2 totally seporate loop statements, so this is what I did:

For 
    If $Formating = 1 Then  
        $a = 1 To $looping - 1
    Else
        $a = 1 To $looping
    EndIf

I'm getting an error with this. I've tried various combonations surrounding this small statement, but all of them produce errors. Is something like this possible, or do I need to do two entire loop functions?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm trying to do a loop based on a condition without forming 2 totally seporate loop statements, so this is what I did:

For 
    If $Formating = 1 Then  
        $a = 1 To $looping - 1
    Else
        $a = 1 To $looping
    EndIf

I'm getting an error with this. I've tried various combonations surrounding this small statement, but all of them produce errors. Is something like this possible, or do I need to do two entire loop functions?

why not just:

If $formatting = 1 Then 
$step = -1
Else
$step = 1
EndIf
For $a = 1 To $looping Step $step

***edit*** apparently changed [ autoit] [ /autoit] tags to [ code] [ /code] tags, since the former didn't work for me...

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Thanks, but that doesn't work...or at least the way I need or expect it to work.

$looping is a variable input box that determines how many times the looping is suppose to function.

If $Formatting = 1 then I want $looping to happen one less times. If $Formatting does not equal one, then the $looping happens to whatever number specified in the input.

With what you gave me, if it equals 1, which would be "-1", the loop just happens once...meaning it doesn't loop. And the Else, will make it just continue none stop.

What now?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

For $a = 1 To $looping - $Formatting
...
Next

only works if $formatting is 0 or 1

else you could do like

if $formatting Then
For $a = 1 To $looping - 1
_function()
next
else
for $a = 1 to $looping
_function()
Next
Endif

func _function()
...
endfunc

typed in the brouwser so dont hang me...

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

The second one is what I was trying to avoid because it would make the script too big. The first one was causing problems.

What I did was take the idea of the first one and added something to it. I made a checkbox activate a hidden inputbox with a 1 or 0, and had the "Formatting" read that inputbox. That worked.

Thanks for your help though.

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
Sign in to follow this  
Followers 0