Terenz

For loop and True-False

4 posts in this topic

There is a better way to write this sort of pseudo-code?

Local $aTEST[4] = [True,False,False,True]

For $i = 0 To UBound($aTEST) - 1
    If $aTEST[$i] = True Then
        ConsoleWrite(False & @CRLF)
        ; MyFunc1(False)
        ; MyFunc2(False)
        ; MyFunc3(False)
        ; MyFunc4(False)
        ; MyFunc5(False)
        ; MyFunc6(False)
        ; MyFunc7(False)
        ; MyFunc8(False)
    ElseIf $aTEST[$i] = False Then
        ConsoleWrite(True & @CRLF)
        ; MyFunc1(True)
        ; MyFunc2(True)
        ; MyFunc3(True)
        ; MyFunc4(True)
        ; MyFunc5(True)
        ; MyFunc6(True)
        ; MyFunc7(True)
        ; MyFunc8(True)
    EndIf
Next

Thanks 


Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites



Local $aTEST[4] = [True,False,False,True]

For $i = 0 To UBound($aTEST) - 1
    MyFunc1(Not $aTEST[$i])
    MyFunc2(Not $aTEST[$i])
    MyFunc3(Not $aTEST[$i])
    MyFunc4(Not $aTEST[$i])
    MyFunc5(Not $aTEST[$i])
    MyFunc6(Not $aTEST[$i])
    MyFunc7(Not $aTEST[$i])
    MyFunc8(Not $aTEST[$i])
Next

 

Share this post


Link to post
Share on other sites

You have right, "Not" convert True to False e False to True. Thanks


Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Share this post


Link to post
Share on other sites

 

I prefer to do the operation Not inside the function.

 

Saludos

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