Constant arrays
BlitzMax Forums/BlitzMax Beginners Area/Constant arrays
| ||
Can we have them?Const cash_value:Int[] = [5000, 10000, 15000, 20000, 25000, 50000, 75000, 100000]"Compile Error: Constant initializers must be constant" |
| ||
I tried that long time ago. It's not possible but that would be nice. |
| ||
Const cash_value1 = 5000 Const cash_value2 = 10000 Const cash_value3 = 15000 Const cash_value4 = 20000 Const cash_value5 = 25000 Const cash_value6 = 50000 Const cash_value7 = 100000Makes the Czar sad :'( |
| ||
Just make it global... |
| ||
But Consts are faster than Globals! |
| ||
If you've optimized your game to the point where a global array vs a constant array is your greatest concern, it's finished. Ship it. |
| ||
I HAVE OCD THEY MUST BE CONSTANTS AT ALL COSTS. |
| ||
Obsessive Constant disorder? |
| ||
While we're at it, today I decided I need a `Welse` command... ie While something=something else 'do stuff Welse 'do something else Wend Becauuuuuuse... while is like an `if` statement, so why not have a section of code that gets run when the while condition is no longer met, so that you can actually use it in place of an if-else-endif? |
| ||
Wouldn't anything after you put after the Wend basically be the Welse part? Since it is going to exit the While loop after doing the Welse anyway?!?! |
| ||
If you mean it should run the Welse if the While condition is not met at the first instance, you could try this:If Not condition 'code Else Repeat 'code Until Not Condition End If |
| ||
No, you only want to do the welse part if the while was not executed. So it'd be like... .Top If condition 'do stuff goto .Top else 'do stuff endif Pretty much like Czar said. I tend to use while's to replace IF statements so it'd just be handy to be able to incorporate an `else` action. |
| ||
I am sure he was just being funny. ..?? |
| ||
Why not use Ifs? |
| ||
I was a few seconds too late. I meant that about IH but I guess not |
| ||
Of course you can use if's but if you want to do an `if-loop` such as While, then you have to separate out the if-else from the looping. Just an idea. |