Understanding Const Expression in VBScript

Well, I'm trying to understand the limitations in expressions Constin VBScript. I could not use anything but literals. What docs say :

A literal or other constant, or any combination that includes all arithmetic or logical operators except Is .

So, if "includes all arithmetic or logical operators", then logically I expect that I can do something like this:

Const X = (1 + 2)

But this leads to the "Expected literal constant" error. I found an interesting answer here that allows you to cheat at some level, so the above can be done with:

Execute "Const X = " & (1 + 2)

But my question is about declaring a standard constant. If by chance the documents said something like "the expression could be ONLY literal," then I would never ask.
So what else can I use (other than literal)?

+5
source share
1 answer

Script56.chm says the following in the Notes section:

By default, constants are publicly available. Within procedures, constants are always private; their visibility cannot be changed. Within the default script, the visibility of the script-level constant can be changed using the Private keyword.

, . , Public Private, , .

, VBScript ( Chr) . . , , .. . , Sub Function, . , , script, . , .

" , , Is".

+3

All Articles