# Priority problem SOLVED

## Recommended Posts

i have a loop and 4 functions

the problem is that i only want the loop to execute one function at a time

i explain deeper

when the loop enters the first time

i want it to only execute function1, if function 1 is TRUE then i want to run function1 even next time the loop executes

but if function1 is FALSE then when the loop executes i want it to choose function2 instead

and if function2 is true then execute it next time but if its FALSE go for function3 and so on...

i hope someone can help me in this matter

```For \$i = 1 To 64 Step +1

function1()
function2()
function3()
function4()
Next

Func function1()
;code
EndFunc

Func function2()
;code
EndFunc

Func function3()
;code
EndFunc

Func function3()
;code
EndFunc```
Edited by joeyone

##### Share on other sites

Like this?

```\$runNext = 1

For \$i = 1 To 64 Step +1
Select

Case \$runNext = 1
If function1() Then
\$runNext = 1
Else
\$runNext = 2
EndIf

Case \$runNext = 2
If function2() Then
\$runNext = 2
Else
\$runNext = 3
EndIf

Case \$runNext = 3
If function3() Then
\$runNext = 3
Else
\$runNext = 4
EndIf

Case \$runNext = 4
If function4() Then
\$runNext = 4
Else
\$runNext = 1
EndIf

EndSelect
Next

Func function1()
;code
EndFunc

Func function2()
;code
EndFunc

Func function3()
;code
EndFunc

Func function3()
;code
EndFunc```

[font="Fixedsys"][list][/list][/font]

##### Share on other sites

yes that nice

thank you!

Like this?

```\$runNext = 1

For \$i = 1 To 64 Step +1
Select

Case \$runNext = 1
If function1() Then
\$runNext = 1
Else
\$runNext = 2
EndIf

Case \$runNext = 2
If function2() Then
\$runNext = 2
Else
\$runNext = 3
EndIf

Case \$runNext = 3
If function3() Then
\$runNext = 3
Else
\$runNext = 4
EndIf

Case \$runNext = 4
If function4() Then
\$runNext = 4
Else
\$runNext = 1
EndIf

EndSelect
Next

Func function1()
;code
EndFunc

Func function2()
;code
EndFunc

Func function3()
;code
EndFunc

Func function3()
;code
EndFunc```

## Create an account

Register a new account