Terenz

For loop and True-False

4 posts in this topic

#1 ·  Posted

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



#2 ·  Posted

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

#3 ·  Posted

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

#4 ·  Posted

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