Lesson 2


Programmer's Vocabulary
Data. Information. Things like a character's name or hit points.
Variable. Used to hold data.
String. Data that is text.
Integer. Data that is a number without a decimal point.
Input. Data that goes into your game.
Output. Data that comes out of your game.
FB Vocabulary
Dim Creates a variable.
Input Gets a line of data from the player.
; Pastes two bits of data together in Print
; Separates Input from a variable.
= Puts data in a variable.

Code Examples

Example 1.

Print "You have" ; 100 ; " gold coins."

Example 2.

Dim gold As Integer
gold = 100

Print "You have" ; gold ; " gold coins."

Example 3.

Dim playerName As String
Dim gold As Integer

Input "What is your name" ; playerName
Print playerName ; ", you have" ; gold ; " gold coins."



1. Data is information. A character's hit points is data. A character's name is data. Any information that you want your game to remember while it's running is data.

2. A literal is data you put directly into your game code. It doesn't come from outside your game —- it is already there.

String literals are enclosed in quotes :

Print "string literal"

Numeric literals are not :

Print 42

3. Output is anything that comes out of your game. The text displayed in the examples above is output. Graphics seen by the player is output. When your game saves to a file, it is outputting to the file.

4. The semicolon is shown having two uses in this lesson. The first is discussed presently. When used between two chunks of output data in Print, it pastes the chunks of data together before they are outputted to the screen.

5. Input is anything that comes into your game. Mouse clicks are input. Pressing buttons on a joystick or gamepad is input. When your game opens a file to get information, it is getting input.

6. The Input function pauses the game and waits for the player to enter data and press enter. Once this happens, it puts the data entered by the player into a variable and resumes the game.


  • Write a game that asks for the player's name and then insults hiim.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.