Select Case an Array
BlitzMax Forums/BlitzMax Beginners Area/Select Case an Array
| ||
| Another quick question, how would I use an array with Select? Local MyArray:string[5] Select MyArray Case EndSelect How would Case work? :o |
| ||
| select is just a different way of doing an "if then elseif" this : if a = 1 then ------ elseif a = 2 then ------- elseif a = 3 then -------- elseif a = 4 then -------- else -------- endif is the same as this:
select a
case 1
------
case 2
-------
case 3
-------
case 4
-------
default
--------
end select
so it depends what you want to do with the array that will determine how you construct the select/case. |
| ||
| But i want to compare the entire array in one case D: |
| ||
| if you explain exactly what you want to do, there might be a way or an alternative route for you to take. |
| ||
| How about this... |
| ||
| But i want to compare the entire array in one case D: I guess you could do this: Local myarray1:String[] = [ "a", "b", "c", "d" ] Select True case myarray1[0] = "a" and myArray1[1] = "b" print "yes" default print "no" End Select But it's fugly. |
| ||
| Concatenate all your strings together and then check...a bit like a 'key field' in some databases. |