Jump to content
Sign in to follow this  
jaberwacky

Is this possible?

Recommended Posts

jaberwacky

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

Share this post


Link to post
Share on other sites
jebus495

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.

Share this post


Link to post
Share on other sites
jaberwacky

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!

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.