O'Reilly logo

DarkBASIC Pro Game Programming, Second Edition by Joshua R. Smith, Jonathan S. Harbour

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Variables

I briefly mentioned variables in the last chapter (enough to tantalize you?), but this chapter is dedicated to the subject. One might go so far as to claim that variables are the foundation of computer programs. Variables provide a means to store data in a program. A variable is stored in memory and accessed through its name, like this:

HugeNumber = 3828549
DecimalNumber# = 3.14159265
Person$ = "Hayao Miyazaki"

As you can see, variables can store numbers or words (also called strings).

What Is a Variable?

In the old days when programmers used machine and assembly language, they would create variables by simply grabbing a chunk of memory and then storing a number in the newly acquired spot. This was called memory allocation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required