Topic: APLX Help : Help on APL language : APL Primitives : ⍞ Character input
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Character input


The symbol causes the computer to accept data typed on the keyboard. Whatever is typed is treated as characters, even if it is made up of the digits 0 to 9. (See if you require numeric input, or alternatively use ⍎, (execute) to convert text data to numeric data.)

does not cause a carriage return when used for output.

             A←⍞                     (The cursor is placed at the beginning of
       HELLO                          the next line and whatever is typed is
                                      accepted.  Note there is no prompt. The
                                      characters HELLO are put in A.
             A                        the contents of A are displayed)
       HELLO
             X←⍞
       12                            (12 is put in X as a 2-character data item)
             X+5
       DOMAIN ERROR                  (The 12 in X is two characters . Characters
             X+5                      can't be used in arithmetic. See ⍎ if
             ^                        you want to convert characters to numbers.)

An extract from a user-defined function:

       [3]  'PLEASE TYPE YOUR NAME.'
       [4]  NAME←⍞                   (The response is put in NAME)
       [5]  'THANK YOU ',NAME        (The contents of NAME are
                                      displayed after 'THANK YOU ')

The dialogue will look like this:

      PLEASE TYPE YOUR NAME.
      REGINALD
      THANK YOU REGINALD

Topic: APLX Help : Help on APL language : APL Primitives : ⍞ Character input
[ Previous | Next | Contents | Index | APL Home ]