Difference between revisions of "Literals"

From emotive
Jump to navigation Jump to search
(Created page with "== Description == A literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, fl...")
 
Line 1: Line 1:
 +
{{DISPLAYTITLE:Data Type '''Literals'''}}
 
== Description ==
 
== Description ==
 
A literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, floating-point numbers, and strings, booleans and characters.
 
A literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, floating-point numbers, and strings, booleans and characters.

Revision as of 11:08, 15 July 2014

Description

A literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, floating-point numbers, and strings, booleans and characters.

Literals are often used to initialize variables, for example, in the following, '1' is an IntegerLiteral which is assigned to a new created variable 'a' of data type Integer. And the three letter string in "cat" is a StringLiteral, which is assigned to a new created variable 's' of data type String.

Integer a = 1;
String s = "cat";

All OTX Core data types (without the Exception type) provide a literal notation term.