Float Literal represents Float Data Type and value and supports multiple notations.
Float literal is used to represent real number.
It is written by adding letter "F" as suffix (in upper or lower case).
Float Literal Notations
var value : Float = 65.23f //Basic notation.
var value : Float = 0.6523E2F //Scientific notation.
Double Literal represents Double Data Type and value and supports multiple notations.
Double Literal Notations
var value : Double = 65.23 //Basic notation.
var value : Double = 0.6523E2 //Scientific notation.
Character literal
● represents character data type and value where value is 16-bit Unicode character
● is constructed by enclosing character or escape sequence inside single quotes
Escape sequence
● can represent any character, including special ones, as shown by the table below
● starts with backslash / escape character followed by specific combinations representing a character
Using octal or Unicode character representations is equivalent to typing that character inside your source code.
This differs from escape sequences \n, \' or \" which will not throw error while '\u000D', '\u0027' or '\u0022' might.
Character
//BASIC CHARACTER LITERAL.
var value : Char = 'A' //'A' character.
var value : Char = '\t' //Tab character.
var value : Char = '\"' //Double quote character.
var value : Char = '\'' //Single quote character.
//USING OCTAL ESCAPE SEQUENCE.
var value : Char = '\101' //'A' character.
var value : Char = '\10' //Tab quote character.
var value : Char = '\42' //Double quote character.
var value : Char = '\47' //Single quote character.
//USING UNICODE ESCAPE SEQUENCE. USES HEXADECIMAL ASCII VALUES WITH LEADING ZEROS.
var value : Char = '\u0041' //'A' character.
var value : Char = '\u0009' //Tab character
var value : Char = '\u0022' //Double quote character
var value : Char = '\u0027' //Single quote character reports error.