Liberty Basic 2
First, let's consider exactly what a computer is; what it can do and what it can't do. A computer is nothing more than a sophisticated calculator. If you have a calculator handy, get it out and have a look at it. You will notice that it has a keypad for the numerals zero to nine, keys for Plus (+), Minus (-), Multiply (*) and Divide (/). It may also have a few other functions like Percent, Add to Memory, Return from Memory, etc. This is the equivalent of the keyboard on your computer, except that the PC keyboard was some extra capabilities, most noticeably the ability to type in text. We'll get to that a little later.
Command PRINT displays text or numbers on the screen. The program line looks like this:
PRINT ?My name is Nick.?
Type the bolded text into QBasic and press F5 to run the program. On the screen you?ll see
My name is Nick.
Note: you must put the text in quotes, like this ? ?text?. The text in quotes is called a string.
If you put the PRINT alone, without any text, it will just put an empty line.
PRINT can also put numbers on the screen.
PRINT 57 will show the number 57. This command is useful for displaying the result of mathematical calculations. But for calculations, as well as for other things in the program, you need to use variables.
Perhaps you found your way here either because you're new to programming and would like to start of by learning BASIC, or on the other end you're an experienced programmer looking to hone your skills. While this tutorial primarily focuses on the former, I'll write separate sections for advanced techniques as well.The thing I find most irritating about tutorials, especially on the internet, is they usually assume previous knowledge of one langauge or another. As well, they often throw things at you and hardly explain what they mean, and why it's like that. I hope to break that trend, or at least go against it with this tutorial.
In the early days of programming, it was usually the scientific elite doing the programming and they were usually trained above and beyond the average American to do their programming work. It was not until 1964 at Dartsmouth college that the Beginner's A
ll-purpose Symbolic Instruction Code would be introduced -- more commonly known as BASIC. Using common English to perform processor tasks, BASIC became quickly popular, although it was disliked by programmers of more "low-level" languages such as assembly
and FORTRAN. In 1985 Microsoft released their own version of BASIC called QBasic with their MS-DOS 5.0 operating system. Since then, nearly every PC user owns their own copy of QBasic, making it a widely known language.
is How to Use Basic
BASIC stands for Beginner's Symbolic All-Purpose Instructional Code -- another case of the acronym preceding the full name.
Regardless, BASIC is a trivial language to learn and to write simple programs in. In fact, BASIC has been used to drive automatic test equipment for years, so it was a natural choice for the remote testing
system. PRINT is a commonly used statement which prints out values or strings. PRINT always adds a linefeed, unless the statement is followed by a semicolon or a comma. A semicolon merely suppresses the linefeed, while the comma allows simple alignment of data in columns. Any number of variables may follow a PRINT statement, separated by commas or semicolons.