EduGateway(TM) QBASIC Help


Variable
A "variable" is like a box where your program can store different kinds of information. Some boxes (variables) can hold numbers, and some can hold letters and words. The computer actually uses two main types of numbers. The computer can use whole counting numbers (like 0, 1, 2, 3...). These are called "INTEGER" numbers. The computer can also use real numbers to represent things that don't always come in whole chunks. The most common of these is called "SINGLE". The word "SINGLE" is a computer term to describe how accurate the number will be.
=
The "=" sign is the assignment operator. It tells the computer to copy the information on the right side into the variable (box) on the left side.
+
The "+" sign is an operator. It tells the computer to add the two numbers on either side.
*
The "*" sign is an operator. It tells the computer to multiply the two numbers on either side.
( )
The "( )" signs are used to group things to be done first. For example:
        3 + (2 * 2) is the same as 3 + 4 which is 7
but:
        (3 + 2) * 2 is the same as 5 * 2 which is 10
SCREEN
The "SCREEN" statement prepares the computer to display graphics or text. Different computers have different kinds of graphics capabilities, and the SCREEN statement allows a programmer to select a screen that works well for their application. The number following the screen statement selects the type of screen to use. If the computer doesn't support the selected screen number, then an error will occur. In this case, you must select a different number. In QBASIC, the screen numbers range from 0 to 13. Try different screen numbers to see which ones are supported by your computer.
DIM
The "DIM" statement tells the computer to set aside storage space for your program's variable data (usually numbers and letters). The word "DIM" is short for "DIMension". If you think of program variables as boxes where the computer can store things, then the term "DIMension" is used to tell the computer the size or dimensions of that box.
AS
The "AS" keyword links a variable with its data type (see INTEGER).
INTEGER
The "INTEGER" keyword is one of the data types in QBASIC. The integer data type tells the computer that the associated variable will only hold whole numbers (like 0,1,2,3...). Integers can also store negative whole numbers (like -1,-2,-3...).
DO
The "DO" statement tells the computer to do a bunch of statements over and over again. The DO is usually used with another kind of statement to tell the computer how long to DO the same bunch of statements. Also see the LOOP statement.
LOOP
The "LOOP" statement tells the computer to loop back to the matching "DO" statement. Also see the DO statement.
RND
The "RND" function tells the computer to pick a random number.
CIRCLE
The "CIRCLE" statement tells the computer to draw a circle. The numbers following the CIRCLE statement tell the computer more details about how to draw the circle. The most important details are where to draw it, and how big to make it. The "where" part is specified by a pair of coordinates like (x,y), and the "how big" part is specified by the radius which follows the coordinates. The following example draws a 20 pixel-wide circle with its center at x=50 and y=70:
        CIRCLE (50,70),10
Question: Why is a 20 pixel wide circle drawn with radius = 10 ?
    Hint: What's the difference between a radius and a diameter ?
PRINT
The "PRINT" statement tells the computer to draw letters and/or numbers on the screen. The print statement keeps printing more information on the screen until it runs out of room. Then it scrolls the screen up one line to make room for the next line.

© 1997-2000 EduGateway(TM)