O'Reilly logo

Learn to Program with Small Basic by Ed Price, Majed Marji

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

4USING VARIABLES

image

Have you ever wanted to be a doctor, astronaut, firefighter, animator, mayor, botanist, or ninja? What if you could be all of them but just one at a time? A variable can be anything in your programs, like a string or a number, but it can only be one thing at a time. For example, a number-guessing game might ask the player to enter their name (a string) and then greet the player using that name. Next, the program might ask them to enter their first guess for the game (a number) and then check to see if they guessed correctly.

For the game to work, it must remember, or store, the data entered by the player. It also might need to ...

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