String Data Type
A string literal is a string value enclosed in either double quotes or single quotes. Following are some of the examples of string literals:
“What is your name?”
Number Data Type
Integer literals may be written either in decimal, hexadecimal or octal notation. Examples of decimal integer literals are given below:
2, 100, 0, -1, -200
A hexadecimal integer literal starts with “0x” or “0X”. Following are examples of hexadecimal integer literals:
0x4, -0x2, 0xFF, 0X10, 0XA2
Octal integer literals start with 0 and may contain digits 0 through 7. Following are examples of octal integer literals:
04, 05, 010, -02, 00, 012
Floating point numbers
Floating point numbers are written using base 10. They may contain fractional parts separated by a decimal point. Scientific notation is also allowed. Following are some examples of floating point numbers:
.001, 0.01, 3.4, 4, -2, 2e2, 2.3e4, 2e-3, 4.5e-2
Boolean Data Type
A boolean type variable can hold only two values: true or false. A non-zero value is treated as true and zero is treated as the boolean value false.
Every programming language supports comments through which a programmer can provide details like author name, creation date and purpose of the script. Apart from these details, comments allow programmers to write explanations or reviews about their script or elements in the script.