Well, the actual question asks "why" it occurs, not really "how to fix" it,
So...
In Universe Basic one doesn't have to define the length of an input value,
tho' one can,
eg INPUT ANS,1
Instead it allows any length of input, so a space bar entry might just be
part of a string entered - as one could enter in response to a prompt for
"Reason for discard"
something like
"the item was run over by a rampant forklift and is in a sorry state"
even if the prompt was masked as a 20 character prompt. You will see that
the input contains embedded spaces. If the system were to react to a single
space, as if to interpret the space as being
SPACE : CR
the first space would end input of the string and you would end up with just
"the"
One way to beat this, and still allow you to use a single space as an exit
character, would be to create a loop that inputs a single character, then
tests if that character is a space. If so, exit the loop, if not, append
that character to the end of a string, eg
InputtedValue = ''
Loop
Input Val,1:
if Val=' ' then exit
InputtedValue := Val
Repeat
On exit via the entry of a single space, the string InputtedValue will
contain all the inputted field.
Note: the : at the end of the Input Val,1: statement makes the input prompt
wait at the end of the string already entered, giving the impression that
the program is actually accepting the whole string as a single entry, and
not just a character at a time.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve Ferries
Sent: 29 April 2008 09:46 PM
To: [email protected]
Subject: [U2] Press any key to continue...
Hi All,
We were coding a standard INPUT ANS after asking a user to "Press any key to
continue...".
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/