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 ...

Get Learn to Program with Small Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.