Len Function: To Return The Number of Characters in

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

GW-BASIC User's Guide

LEN FUNCTION
Purpose:
To return the number of characters in x$.

Syntax:
LEN(x$)

Comments:
Nonprinting characters and blanks are counted.

Example:
x$ is any string expression.
10 X$="PORTLAND, OREGON"
20 PRINT LEN(X$)
RUN
16
Note that the comma and space are included in the character count of 16.

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/LEN.html28/03/2004 21.29.34
GW-BASIC User's Guide

LINE INPUT Statement


Purpose:
To input an entire line (up to 255 characters) from the keyboard into a string variable, ignoring
delimiters.

Syntax:
LINE INPUT [;][prompt string;]string variable

Comments:
prompt string is a string literal, displayed on the screen, that allows user input during
program execution.
A question mark is not printed unless it is part of prompt string.
string variable accepts all input from the end of the prompt to the carriage return. Trailing
blanks are ignored.
LINE INPUT is almost the same as the INPUT statement, except that it accepts special characters
(such as commas) in operator input during program execution.
If a line-feed/carriage return sequence (this order only) is encountered, both characters are input
and echoed. Data input continues.
If LINE INPUT is immediately followed by a semicolon, pressing the RETURN key will not move
the cursor to the next line.
A LINE INPUT may be escaped by typing CTRL-BREAK. GW-BASIC returns to command level
and displays Ok.
Typing CONT resumes execution at the LINE INPUT line.

Example:
100 LINE INPUT A$
Program execution pauses at line 100, and all keyboard characters typed thereafter are input to
string A$ until RETURN, CTRL-M, CTRL-C, or CTRL-BREAK is entered.

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/LINEINPUT.html28/03/2004 21.29.35

You might also like