Jump to content
Sign in to follow this  

How to write a constants include file?

Recommended Posts


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"]]

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


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.