# Literals

## Literal Constants

When a value is actually written in the program it is constant. Perhaps it would be more correct to such a value a 'Literal Constant'. In practice the term 'Literal' is used for short.

Literals are either numeric or character strings. We have already seen examples of both. In the following example:

`put "Please enter your name:"`

the text enclosed in those quotes is a literal and is constant. It never changes while the program is being run and it is the same every time the program is run.

Similarly if in a program you need to multiply a value by 3, then 3 is a constant because it will always be 3 in that part of the program.

`x = y * 3`

## Literals in Expressions

Literals may be used anywhere in an expression. For example.

```put "The number" 7 "is my lucky number"
put "The value of PI is" 3.14159265```

will show:

```The number 7 is my lucky number
The value of PI is 3.14159265```

## String Literals

`put "The value of PI is" 3.14159265`

In the above example the text “The value of PI is” is a string literal constant or string literal for short.

## Numeric Literals

`put "The value of PI is" 3.14159265`

In the above example the value 3.14159265 is a numeric literal constant or numeric literal for short.

 ⇐ Data LynPlexC Programming Constants ⇒