{{htmlmetatags>metatag-robots=()
metatag-title=(INPUT | ugBASIC User Manual)
metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum)
metatag-description=(Manual page for INPUT)
metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png)
metatag-og:title=(INPUT | ugBASIC User Manual)
metatag-og:description=(Manual page for INPUT)
}}
====== ugBASIC User Manual ======
===== INPUT ✓ =====
===== SYNTAX =====
INPUT var1 [, var2 [, ..]] [;]
INPUT [prompt;] [var1] [, var2 [, ..]] [;]
INPUT [prompt,] [var1] [, var2 [, ..]] [;]
==== PURPOSE ====
The ''INPUT'' provides a standard way of entering information into one or more variables.
There are two possible formats for this instruction.
The first require that the programmer enters a list of variables directly as a list.
Each variable must be separated by a comma. A question mark will be automatically displayed
at the current cursor position.
The second needs a string as the first parameter. The string will be used as a prompt
before entering information. When a semicolon ('';'') is used after the text output to
the user, a question mark (''?'') is added to the output. When a comma ('','')
is used, no question mark is added.
When you execute one of these commands, ugBASIC will wait to enter the required
information from the keyboard. Each variable must be matched by a single value from the user.
These values must be of the same type as the original variables, and they should
be separated by commas.
If a string is specified (e.g., ''name$''), anything the user
enters before pressing the 'return' key will be accepted. If a numeric variable
(e.g., 'age') is specified, the user must enter a number. If any non-numeric key
is entered, the value 0 will be returned.
The optional semi-colon '';'' at the end the variables list specifies that the
text cursor will not be affected by the ''INPUT'' instruction, and it will retain its
original position after the data has been entered, instead of moving to the next line,
following the enter key.
Note that the separator character can be changed by using the ''DEFINE INPUT SEPARATOR''
command, by giving the ASCII code value to use instead of the default (comma). Moreover,
the size of the input buffer can be changed using the ''DEFINE INPUT SIZE'' instruction.
Finally, the character used as cursor can be changed using the ''DEFINE INPUT CURSOR''
instruction.
==== EXAMPLE ====
INPUT age
INPUT "what is your name"; name$
INPUT "digit a number [0-9]:", number
See also the following example files:
* ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/control_case_01.bas|control_case_01.bas]]''
==== ABBREVIATION ====
Ip
==== AVAILABLE ON ====
* Atari (400/800)
* Atari XL/XE
* Commodore 128 (MOS 8502)
* Commodore 128 (Zilog Z80)
* Commodore 64
* Commodore 64+REU
* TRS-80 Color Computer
* TRS-80 Color Computer 3
* ColecoVision
* Amstrad CPC 664
* Dragon 32
* Dragon 64
* Thomson MO5
* Thomson MO5
* Olivetti Prodest PC128
* Commodore PLUS/4
* SEGA SC-3000
* SEGA SG-1000
* VG-5000
* Commodore VIC-20
* ZX Spectrum 48
==== ANY PROBLEM? ====
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON INPUT|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY =====
[[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]