1. Can't use global/public constant in switch/case ?

If using a global or public constant(s) declared in another file in a switch statement, it won't resolve. Is this known?

constant 
C1 = 1, 
C2 = 2, 
C3 = 3 
 
switch x do 
  case C1 then 
    ... 
  case C2 then 
    ... 
  case C3 then 
    ... 
end switch 

The above works, but if C1, etc are declared in an included file (as global or public), it doesn't work, although those constants seem available otherwise.

new topic     » topic index » view message » categorize

2. Re: Can't use global/public constant in switch/case ?

Euphoria Interpreter v4.0.0
Linux, Using System Memory
Revision Date: 2010-12-22, Id: 115714454200

seems to only affect global switch statements

ie:
if the switch statement appears inside
a procedure or function, then the
error goes away

have'nt read the eu4 manual.

this may be by design

a

new topic     » goto parent     » topic index » view message » categorize

3. Re: Can't use global/public constant in switch/case ?

AndySerpa said...

If using a global or public constant(s) declared in another file in a switch statement, it won't resolve. Is this known?

No, that should work. I've created ticket:617 for this issue.

As a work around, you can use qualified references (i.e., use a namespace qualifier).

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu