Jump to content

Recommended Posts

Posted

So I'm trying to operate a WHILE 1 statement and ideally it would run 20 times before continuing to another part of the script. First, I don't know how to designate that it occur 20 times, and second I don't know how to tell it to go to another part of the script when 20 cycles have completed. Can anyone help?

Posted (edited)

WHILE is not designed to run a sequence 20 times. It is supposed to run a sequence as long as a certain assesment is TRUE.

a = 1

WHILE a<10

a = a+1

WEND

will run the sequence 9 times then will exit.

If you want to execute somethibg 20 times, use FOR i=1 to 20 DO

It is design for that.

Edited by happyuser
Posted

WHILE is not designed to run a sequence 20 times. It is supposed to run a sequence as long as a certain assesment is TRUE.

a = 1

WHILE a<10

a = a+1

WEND

will run the sequence 9 times then will exit.

If you want to execute somethibg 20 times, use FOR i=1 to 20 DO

It is design for that.

so how would i designate a DO IT statement?

Posted

Maybe....

Dim $x

While 1
    $x = $x + 1
    
    If $x <= 20 Then
        Do_This()
    EndIf
    
    If $x >= 21 Then
        Start_This($x)
    EndIf
    
    ; start all over
    If $x >= 40 Then $x = 0
    
WEnd

; --- Functions ----

Func Do_This()
    MsgBox(0x0, $x, " Count is " & $x, 2)
EndFunc   ;==>Do_This

Func Start_This($in)
    MsgBox(0x0, $in, " Count is " & $in, 2)
EndFunc   ;==>Start_This

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...