0

We have some constants inside our project. One is for the URL of a server. Is it possible to make the constant being different when in test mode?

Something like:

IF InTestMode() THEN
    CONSTANT URL = "http://test.com"
ELSE
    CONSTANT URL = "http://prod.com"
END

Thanks.

MHogge
  • 5,408
  • 15
  • 61
  • 104

1 Answers1

1

Constant are in fact supposed to be constants.

What you are searching for is a global variable defined at project level. You can initialize your variable the way you want, using or not your constant with something like that :

CONSTANT
    URL_PROD = "http://prod.com"
    URL_TEST = "http://test.com"
END

gsURL is a string = InTestMode() ? URL_TEST ELSE URL_PROD