Jump to content

Recommended Posts

Posted (edited)

I have this section of code:

For $i = 31 To 0 Step -1
     If $redArray[$i] == "" Then
          _ArrayDelete($redArray, $i)
     EndIf

     If $whiteArray[$i] == "" Then
          _ArrayDelete($whiteArray, $i)
     EndIf
Next

Let's say I change it to:

For $i = 31 To 0 Step -1
     If ($redArray[$i] == "") Or ($whiteArray[$i] == "")  Then
          _ArrayDelete($redArray, $i)
          _ArrayDelete($whiteArray, $i)
     EndIf
Next

Could I make a certain block of code execute depending on whether the condition in the first set of parens were true? For instance, if ( $redArray[$i] == "" )evaluated to true then _ArrayDelete($redArray, $i) would be the only line of code that was executed. Vice versa, if ( $whiteArray[$i] == "" ) evaluated to true then only _ArrayDelete($whiteArray, $i) would execute.

Edited by jaberwocky6669
Posted

What about working with cases?

For $i = 31 To 0 Step -1
Select
   Case ($redArray[$i] == "") 
         _ArrayDelete($redArray, $i)
   Case ($whiteArray[$i] == "")
         _ArrayDelete($whiteArray, $i)
EndSelect
Next

Or even just trimming off the If's

For $i = 31 To 0 Step -1
     If $redArray[$i] == "" Then _ArrayDelete($redArray, $i)
     If $whiteArray[$i] == "" Then _ArrayDelete($whiteArray, $i)
Next

Or at least I'm pretty sure you can do that lol.

Posted

Hey guys, thanks. I guess my idea is kinda pointless huh. I was hoping I was onto some kind of efficient programming method! Anyways, thanks for your replies!

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
×
×
  • Create New...