Top "Constants" questions

Constants in programming are definitions whose value is fixed throughout a program's execution.

ECMAScript 2015: const in for loops

Which of the two (or neither/ both) code fragments below should be working in a complete ECMAScript 2015 implementation: for (const …

javascript for-loop scope constants ecmascript-6
int vs const int&

I've noticed that I usually use constant references as return values or arguments. I think the reason is that it …

c++ coding-style reference constants
const char* and char const* - are they the same?

From my understanding, const modifiers should be read from right to left. From that, I get that: const char* is …

c++ pointers constants
Advantages of using const instead of variables inside methods

Whenever I have local variables in a method, ReSharper suggests to convert them to constants: // instead of this: var s = "…

c# coding-style resharper constants
In Java why this error: 'attribute value must be constant'?

I have some TestNG code, where I am passing a Test annotation parameter called timeOut = TESTNG_TEST_TIMEOUT . @Test(description = "…

java annotations testng constants
Return std::string as const reference

I have a doubt on returning std::string as const reference. class sample { public: std::string mString; void Set(const …

c++ string reference constants stdstring
Naming convention for Scala constants?

What is the naming convention for Scala constants? A brief search on StackOverflow suggestions uppercase CamelCase (the first line below), …

scala naming-conventions constants
Overriding class constants vs properties

I would like to better understand why, in the scenario below, there is a difference in the way class constants …

php oop inheritance overriding constants
Abstract constants in PHP - Force a child class to define a constant

I noticed that you can't have abstract constants in PHP. Is there a way I can force a child class …

php constants abstract
v8 JavaScript performance implications of const, let, and var?

Regardless of functional differences, does using the new keywords 'let' and 'const' have any generalized or specific impact on performance …

javascript performance constants v8 let