bas7advr.hlp (Topic list)
INPUT Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
INPUT allows input from the keyboard during program execution.
 
INPUT [;] ["promptstring"{;|,}] variablelist
    ■ The argument variablelist is made up of one or more variable names,
      each separated from the next by a comma. Each name may refer to:
        - A simple numeric variable.
        - A simple string variable.
        - A numeric or string array element.
        - A record element.
 
Optimization Notes
    ■ If the user will be inputting only decimal integers, you can save
      between 1.6K and 11K in the size of a non-stand-alone .EXE file by
      linking with the stub file NOFLTIN.OBJ. This places the following
      restrictions on user input:
        - Decimal numbers only (no leading &H, &O, or & base specifiers).
        - No trailing type specifiers (%, &, !, #, @, and $).
        - No decimal point, E, or D (for example,1.E2 cannot be used
          instead of the integer 100).
    ■ If the user can be limited to using the Enter and Backspace keys
      for editing, you can reduce the size of the .EXE file by linking
      the stub file NOEDIT.OBJ.
 
Usage Notes
    ■ The INPUT statement causes a running program to pause and wait
      for the user to enter data from the keyboard. The number and
      type of data items required from the user is determined by
      the structure of variablelist.
    ■ The number of entered data items must be the same as the number
      of variables in the list. The type of each entered data item must
      agree with the type of the variable. If either of these rules is
      violated, the program will display the prompt, "Redo from start"
      and input values aren't assigned.
    ■ The INPUT statement determines the number of entered data items
      in a multiple-item list this way:
        - The first character encountered after a comma that is not
          a space, carriage return, or line feed is assumed to be
          the start of a new item.
        - If this first character is a quotation mark ("), the item is
          typed as string data and will consist of all characters between
          the first quotation mark and the second.
        - Not all strings have to start with a quotation mark, however.
          If the first character of the string is not a quotation mark, it
          terminates on a comma, carriage return, or line feed.
    ■ Input stored in a record must be entered as single elements. For
      example:
 
          TYPE Demograph
              FullName AS STRING * 25
              Age  AS INTEGER
          END TYPE
          DIM Person AS Demograph
          INPUT "Enter name and age: "; Person.FullName, Person.Age
 
    ■ You may want to instruct the user on how it is possible to edit
      a line of input before pressing the Enter key to submit the
      line to the program:
 
      Keystrokes              Edit function
      ════════════════════    ══════════════════════════════════════════
      Ctrl+M or Enter         Store input line.
      Ctrl+H or Backspace     Delete the character to the left of the
                              cursor, unless the cursor is at the
                              beginning of the input, in which case
                              it deletes the character at the cursor.
      Ctrl+\ or Right Arrow   Move cursor one character to the right.
      Ctrl+] or Left Arrow    Move cursor one character to the left.
      Ctrl+F or
      Ctrl+Right Arrow        Move cursor one word to the right.
      Ctrl+B or
      Ctrl+Left Arrow         Move cursor one word to the left.
      Ctrl+K or Home          Move cursor to beginning of input line.
      Ctrl+N or End           Move cursor to end of input line.
      Ctrl+R or Ins           Toggle insert mode on and off.
      Ctrl+I or Tab           Tab right and insert (insert mode on), or
                              tab right and overwrite (insert mode off).
      Del                     Delete the character at the cursor.
      Ctrl+E or Ctrl+End      Delete to the end of the line.
      Ctrl+U or Esc           Delete entire line, regardless of cursor
                              position.
      Ctrl+T                  Toggle function key label display on
                              and off at bottom of screen.
      Ctrl+C or Ctrl+Break    Terminate input (exit compiled program).
 
    ■ When you use INPUT with ISAM programs, BASIC performs a CHECKPOINT
      operation every 20 seconds during an INPUT polling loop. A CHECKPOINT
      writes open database buffers to disk.