This section provides a tutorial example on how to use data literals for various data types: TRUE, FALSE, and NULL; decimal, octal and hexadecimal numbers; floating point number format; single quoted, double quoted, and heredoc strings.
To help us understand better on how to use data literals for various data types,
I wrote the following tutorial sample script:
Boolean data literals:
TRUE: 1
false:
Integer data literals in decimal form:
366: 366
-42: -42
6371: 6371
Integer data literals in octal form:
0556: 366
-052: -42
014343: 6371
Integer data literals in hexadecimal form:
0x16E: 366
-0x2A: -42
0x18E3: 6371
Float data literals in hexadecimal form:
3.14159: 3.14159
3e8: 300000000
2.7322e1: -0.0125
String data literals in single quoted form:
Today's Special:
Item\tPrice\tUnit
Apples\t3.49\tkg
Eggs\t1.99\tdozen
String data literals in double quoted form:
Today\'s Special:
Item Price Unit
Apples 3.49 kg
Eggs 1.99 dozen
String data literals in heredoc form:
Today's Special:
Item Price Unit
Apples 3.49 kg
Eggs 1.99 dozen
Null data literals:
NULL:
null: