About: Constant   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

A constant stores a piece of data in a script. It is much like a variable, except that its value is set when the constant is declared and cannot be changed later. Constants are declared by using the keyword "const" before the keyword indicating the type of data (e.g. "float"), and their names are traditionally in all caps. They cannot be defined within a function.

AttributesValues
rdfs:label
  • Constant
rdfs:comment
  • A constant stores a piece of data in a script. It is much like a variable, except that its value is set when the constant is declared and cannot be changed later. Constants are declared by using the keyword "const" before the keyword indicating the type of data (e.g. "float"), and their names are traditionally in all caps. They cannot be defined within a function.
  • Constants can tautologically be defined as those entities which are not variable. More specifically, a constant is an unchanging value. All numbers are constants. 5 will always be 5, just as 339 will always be 339. There does exist constants which are not written numerically, but whose numerical value is represented with letters (otherwise confused with variables if it werent for the fact that they arent variable). Some of the more common non-numerical constants are Euler's number (e), Pi (π), and the imaginary unit i, all of which represent numbers or abstract mathematical concepts.
sameAs
dcterms:subject
abstract
  • Constants can tautologically be defined as those entities which are not variable. More specifically, a constant is an unchanging value. All numbers are constants. 5 will always be 5, just as 339 will always be 339. There does exist constants which are not written numerically, but whose numerical value is represented with letters (otherwise confused with variables if it werent for the fact that they arent variable). When non-numbers are used in place for numbers, these are falsely called "variables" only in that they are substitutions and representations for constant values, but aren't actually representative of (potentially) changing parameters as the typical variable would be. Some of the more common non-numerical constants are Euler's number (e), Pi (π), and the imaginary unit i, all of which represent numbers or abstract mathematical concepts. Other constants are defined and utilized in the physical sciences, like 'c' for the speed of light, 'G' for the gravitational constant, etcetera. Constants have specific values that never change, as long as that meaning is implicitly or explicitly understood within the context of a mathematical problem. Of course 'e' need not always be representative of Euler's constant, 'c' need not always be representative of the speed of light. But these contextual facts must necessarily be plainly obvious or implicitly or explicitly stated. The alternative, aside from the use of simple numbers, is that letters and other such symbols are variables. Variables are changing, or otherwise changeable, such that their value is not known.
  • A constant stores a piece of data in a script. It is much like a variable, except that its value is set when the constant is declared and cannot be changed later. Constants are declared by using the keyword "const" before the keyword indicating the type of data (e.g. "float"), and their names are traditionally in all caps. They cannot be defined within a function. Constants are often used because they are easier to remember than the value they store. For example, when identifying the bard class, most people find it easier to remember "CLASS_BARD" (name of a constant) than "1" (value of that constant). When serving this purpose, a constant is often called a symbolic constant. The other common use for constants is to make it easier to modify a script. Some scripts use values that are somewhat arbitrary (for example, the cost of modifying an item), but that need to be specified within the script. By defining constants for these values, the definitions can be grouped at the beginning of the script, allowing them to be changed without hunting down where they are used within the script. This is of greater benefit when a value is used multiple times within a script (or scripts, if the constant is defined in an include file), as the value can be changed in one place (where the constant is defined) rather than in every place where the constant is used. It has an even greater benefit when dealing with strings that are used multiple times, as a typo in the name of a constant will (in most cases) cause a script to fail to compile, whereas a typo in a string literal will usually be accepted by the compiler. Thus the use of constants allows some typos to be caught before a script is used.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software