×
Menu
Index

Constants

 
Constants are fixed values. Here are a few examples of valid constants.
// This is an integer constant
55
// Here is a floating-point constant
75.2
// Here is a string constant
"This is a test"
// This is an integer constant in hexadecimal (leading 0x)
0x1F
// This is an integer constant in octal (leading 0)
010
 
 
String constants can contain special escape sequences to create unique characters. A caret (^) initiates an escape sequence. Here is a list of the escape sequences that are supported.
 
Escape Character
Meaning
"^a"
Bell (alert)
"^b"
Backspace
"^f"
Form feed
"^n"
New line
"^r"
Carriage return
"^t"
Tab
"^’"
Single quote
"^""
Double quote
"^^"
A single caret character
 
You can also specify characters by specifying the ASCII value of the character using either of the following two formats.
 
"^xNN"     Specifies an ASCII character where NN are two hexadecimal (base 16) digits.
"^NNN"     Specifies an ASCII character where NNN are three octal (base 8) digits.