Jump to content

BASIC Programming/Beginning BASIC/Your First Program

From Wikibooks, open books for an open world

Introduction

[edit | edit source]

Many texts written about programming languages show you a sample program at the beginning of the lesson to help get your feet wet. That is, to become familiar with the syntax and layout of that language. This book is no exception. This sample program will display the text "Hello, world!" to your screen.

Program Examples

[edit | edit source]

Example One (FreeBASIC)

10 CLS
20 INPUT " Enter Your Name ", X
30 PRINT X = " YOUR NAME"
40 END

.

Explanation

[edit | edit source]
  1. CLS stands for 'Clear Screen' and erases everything in the Command Prompt.
  2. PRINT displays everything in between the quotations.
  3. INPUT gives input and tell what to do.
  4. END marks the end of the program (explained later in functions.)
[edit | edit source]

Wikipedia's article on Hello World

  Index Next: Beginning BASIC/PRINT, CLS, and END