Initialise a Const Array
BlitzMax Forums/BlitzMax Programming/Initialise a Const Array
| ||
Pretty sure I've asked this before but can't find it using search or google. Can anyone explain why this compiles: Global PowerupMapping%[]=[0,1,2,3,4,5,6,7] but this fails with "Constant initializers must be constant" Const PowerupMapping%[]=[0,1,2,3,4,5,6,7] So instead of [] I tried: Const PowerupMapping%[8]=[0,1,2,3,4,5,6,7] and it says "Constants must be initialized". hmm It's no big deal, just perplexing as to what the correct syntax is (if any). Perhaps it's not supported. |
| ||
Don't think you can use const arrays. |
| ||
Yeah I think that's what we concluded before, I just keep forgetting... |
| ||
There is no const for objects. An object is just a reference and is allocated at runtime so it can not be const, which is set at compile time. |
| ||
Fair enough. |