10-20-2024, 06:40 PM
(10-20-2024, 06:08 PM)NakedApe Wrote: I've been trying to clean up IF statements in the game I'm working on. Would it be hard to have SELECT CASE work not just with variables but also with arrays and UDTs?
Imagine:
SELECT CASE flag ' (booleans)
CASE .drawShip: .........
CASE .explode: .........
CASE .endRound: .........
END SELECT
Or:
SELECT CASE fatArray()
CASE 0 TO 50: ..............
CASE 51 TO UBOUND(fatArray): ..........
END SELECT
Would this be cool / useful?
I honestly don't see how either of these would work.
CASE .drawship <-- what does this represent?
TYPE POINT
x as long
y as long
END TYPE
DIM User AS POINT, Enemy AS POINT
CASE .x <-- by itself, this does nothing. How could I tell the difference between User.x and Enemy.x?
And the second doesn't look like it's actually using the array either. It looks more as if you're doing a select case with the index of the array:
SELECT CASE index
CASE 0 TO 50
CASE 51 TO UBOUND(Array)
END SELECT
I'm all for expanding things to make them more useful. I just don't see how these would work in the cases you've provided.