Literals

Programming is all about manipulating data. The data you will be dealing with in game programming will be things like the player's score or a character's name. In any program, almost all data begins as a literal.

There are two general types of literals. Numeric literals (for scores) and string literals (for character names).

*English*
The number 42.

*Code*
42
*English*
UnderSea Level 1-2

*Code*
"UnderSea Level 1-1"

You will notice here that the string literal is wrapped in quotes. This helps the computer understand that it is a string literal rather than a numeric literal. String literals can contain numbers as well as letters and special symbols like punctuation.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.