KSagle Posted December 13, 2006 Share Posted December 13, 2006 Hey, I have a bunch of loops comparing certain arrays, such as for $x = 0 to 4 for $y = 0 to 10 If $Card1[$x][$y] == $A[$x][$y] Or $Card1[$x][$y] == 0 Then $Num = 1 Else $Num = 0 EndIf Next Next for $x = 0 to 4 for $y = 0 to 10 If $Card1[$x][$y] == $2[$x][$y] Or $Card1[$x][$y] == 0 Then $Num = 2 Else $Num = 0 EndIf Next Next Etc. The only difference is : $A[$x][$y] The A switches to 2, then 3, etc. I was wondering if there was a way I could put all these loops into one, and simply change that using a variable. Any help would be great, Thanks Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 13, 2006 Share Posted December 13, 2006 Is this what you were looking for? For $x = 0 To 4 For $y = 0 To 10 If $Card1[$x][$y] == $A[$x][$y] Or $Card1[$x][$y] == 0 Then $Num = 1 Else $Num = 0 EndIf If $Card1[$x][$y] == $2[$x][$y] Or $Card1[$x][$y] == 0 Then $Num = 2 Else $Num = 0 EndIf Next Next "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
mikehunt114 Posted December 13, 2006 Share Posted December 13, 2006 You can do loops on variable names using Eval(). That might help you. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
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