Oct 03, 2019 How to Program in Visual Basic.NET (VB.NET) Author Info Tech Tested. Updated: October 3, 2019. Explore this Article Steps Questions & Answers Related Articles. WikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 38 people, some anonymous, worked to. Visual Basic is a third-generation event-driven programming language first released by Microsoft in 1991. In Visual Basic 6, you can create any program depending on your objective. You can create educational programs, financial programs, games, multimedia programs, animations, database applications and more.
< BASIC Programming
BASIC Programming > Beginning BASIC > Your First Program
Introduction[edit]
In the previous code example, we wrote your first BASIC program. In it, you saw examples of PRINT, CLS, and END commands. Their roles in the program may or may not have been apparent at the time, but, as they're so vital to the BASIC language, they will be discussed here.
Output[edit]
Discussion[edit]
From that example, it's fairly easy to deduce what each command does.
- CLS
- An abbreviation that stands for the words CLear Screen. In the above program, when you used CLS on line 60, all of the words that were printed to the screen were wiped away.
- Writes to the screen. There are commands for printing to other things, like a printer, but that's to be discussed later. Each new PRINT command will start printing on a new line. To insert a blank line, don't specify a string to print. The syntax for 'PRINT' is: PRINT '[whatever you want to be printed here]'
- END
- It stops the program at that line; that is, anything that's added after that won't show. That's why the PRINT command on line 90 didn't print anything. The END command can be included in control structures to end the program if a condition is met. This will be discussed with control structures.
What is happening?
- Line 10 the display is cleared.
- Lines 20 through 50 print text to the screen.
- Line 60 clears the display.
- Line 70 shows the message you should see after you run this program.
- Line 80 ends the program.
- Line 90 shows that an END statement stops the program. No instruction following an END statement is executed.
Given the state of computer speed today you should not see the paragraph displayed by lines 20 through 50, it should be cleared by the CLS statement on Line 60 before you have a chance to see it. If you slow the program down you can see the program write the message to the screen. Line 70 is then written to the screen/display then Line 80 stops everything. Line 90 never, ever runs.
Previous: Beginning BASIC/Your First Program | Index | Next: Beginning BASIC/Variables and Data Types |
![Sample Sample](https://pages.cpsc.ucalgary.ca/~saul/vb_examples/tutorial1/school_481_vbintro04.jpg)
![Party Party](/uploads/1/2/5/8/125884008/564641130.jpg)
Retrieved from 'https://en.wikibooks.org/w/index.php?title=BASIC_Programming/Beginning_BASIC/PRINT,_CLS,_and_END&oldid=3599451'