Table of Contents
Just printing 'Hello World' isn't enough, is it? You want to do more than that - you want to take in some input from the user, do something with it and return some information, which is basically what most programs do. We can achieve this using constants and variables.
An example of a literal constant is a number like
5
, 1.23
, 2.95e-3
or
a string like 'This is a string'
or
"It's a string!"
. It is called a
literal because you use its value literally,
for example, the number 2
always represents
itself and nothing else. It is a constant
because its value cannot be changed. Hence, they are referred to as
literal constants.
We will encounter two types of literal constants - numbers and strings.