Constants
Adding const
modifier to a variable declaration will protect it
from being accidentally modified later in the code.
CTL validator will report an error on any attempt to assign a value to a constant.
Note that modifications via function calls, e.g. clear()
, are not checked.
Example 67.19. Constants
const integer INT_CONSTANT = 10; const string MY_ID = "ABC"; const string[] LIST_CONSTANT = ["a", "b", "c"]; INT_CONSTANT = 11; // error MY_ID = ""; // error LIST_CONSTANT[0] = "x"; // error clear(LIST_CONSTANT); // not checked