jaberwacky Posted October 10, 2009 Posted October 10, 2009 (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 October 10, 2009 by jaberwocky6669 Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
daniel02 Posted October 10, 2009 Posted October 10, 2009 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
jebus495 Posted October 11, 2009 Posted October 11, 2009 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.
jaberwacky Posted October 11, 2009 Author Posted October 11, 2009 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! Helpful Posts and Websites: AutoIt Wiki | Can't find what you're looking for on the Forum? My scripts: Guiscape | Baroque AU3 Code Formatter | MouseHoverCalltips | SciTe Customization GUI | ActiveWindowTrack Toy | Monitor Configuration UDF
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now