Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
111 views1 page

2.4 GW-BASIC Statements, Functions, Commands, and Variables: Dat. Data Output by The

This document provides information about GW-BASIC statements, functions, commands, variables and input/output redirection. It explains that keywords like PRINT and GOTO have special meaning and cannot be used as variable names. Commands perform program maintenance tasks in direct mode while statements are executable instructions within a program. Examples are given of redirecting input/output to come from and go to files instead of the keyboard and screen.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views1 page

2.4 GW-BASIC Statements, Functions, Commands, and Variables: Dat. Data Output by The

This document provides information about GW-BASIC statements, functions, commands, variables and input/output redirection. It explains that keywords like PRINT and GOTO have special meaning and cannot be used as variable names. Commands perform program maintenance tasks in direct mode while statements are executable instructions within a program. Examples are given of redirecting input/output to come from and go to files instead of the keyboard and screen.

Uploaded by

Raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

GW-BASIC User's Guide

For further information about these statements and other statements, functions, commands, and
variables mentioned in this text, refer to the GW-BASIC User's Reference.
Some examples of redirection follow.
GWBASIC MYPROG >DATA.OUT
Data read by the INPUT and LINE INPUT statements continues to come from the keyboard. Data
output by the PRINT statement goes into the data.out file.
gwbasic MYPROG <DATA.IN
Data read by the INPUT and LINE INPUT statements comes from data.in. Data output by PRINT
continues to go to the screen.
gwbasic MYPROG <MYINPUT.DAT >MYOUTPUT.DAT
Data read by the INPUT and LINE INPUT statements now come from the file myinput.dat, and
data output by the PRINT statements goes into myoutput.dat.
gwbasic MYPROG <\SALES\JOHN\TRANS.DAT >>\SALES\SALES.DAT
Data read by the INPUT and LINE INPUT statements now comes from the file \sales\john\trans.
dat. Data output by the PRINT statement is appended to the file \sales\sales.dat.

2.4 GW-BASIC Statements, Functions, Commands, and Variables


A GW-BASIC program is made up of several elements: keywords, commands, statements,
functions, and variables.

2.4.1 Keywords
GW-BASIC keywords, such as PRINT, GOTO, and RETURN have special significance for the GW-
BASIC Interpreter. GW-BASIC interprets keywords as part of statements or commands.
Keywords are also called reserved words. They cannot be used as variable names, or the system
will interpret them as commands. However, keywords may be embedded within variable names.
Keywords are stored in the system as tokens (1- or 2-byte characters) for the most efficient use of
memory space.

2.4.2 Commands
Commands and statements are both executable instructions. The difference between commands
and statements is that commands are generally executed in the direct mode, or command level of
the interpreter. They usually perform some type of program maintenance such as editing, loading,
or saving programs. When GW-BASIC is invoked and the GW-BASIC prompt, Ok, appears, the

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter%202.html (5 of 8)28/03/2004 21.28.57

You might also like