Sign in to follow this  
Followers 0
Lej

How to write a constants include file?

3 posts in this topic

So I started building a small program and it started to get a bit big so I decided to move the constants and global variables to a separate file which I could just include. Problem is I'm not sure how to make a constant or global array with set values in this file. I tried a lots of different way and looked on the web but counldn't find how to do it. This is what I want to have:

Global $NonConstantGlobalArray
$NonConstantGlobalArray[0][0] = 1
$NonConstantGlobalArray[1][0] = 2
$NonConstantGlobalArray[2][0] = 3

$NonConstantGlobalArray[0][1] = "tex1t"
$NonConstantGlobalArray[1][1] = "text2"
$NonConstantGlobalArray[2][1] = "text3"

Global Const $ConstGlobalArray
$ConstantGlobalArray[0][0] = 4
$ConstantGlobalArray[1][0] = 5
$ConstantGlobalArray[2][0] = 6

$ConstantGlobalArray[0][1] = "text4"
$ConstantGlobalArray[1][1] = "text5"
$ConstantGlobalArray[2][1] = "text6"

Share this post


Link to post
Share on other sites



Try this format

Global Const $ConstantGlobalArray[2][3] = [[4, 5, 6], ["text4", "text5", "text6"]]

;test
For $i = 0 To UBound($ConstantGlobalArray) -1
    For $ii = 0 To UBound($ConstantGlobalArray, 2) -1
        MsgBox(0x40000, '[' & $i & '][' & $ii & ']', $ConstantGlobalArray[$i][$ii], 2)
    Next
Next

;)

Share this post


Link to post
Share on other sites

Thanks for the help ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0