Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
There have been many examples of printing output for the user using the print statement. You can also generate output for the user using printf. Here is an example:
printf('The current register value is 0x%x\n',753)would result in the output:
The current register value is 0x2f1(See § 10.5.2, page for a discussion of all of the options available with printf.)
You can get input from the user using the readline function. This function allows the user to enter strings to be used by a script, for example:
print readline()would prompt the user with
>>
:
>> first stringand the string entered by the user, here
first string
, is returned as
the result of readline()
. The prompt can be changed from the default
>>
to something else with the prompt parameter:
print readline(prompt='ANOTHER>> ')In this case,
ANOTHER>>
is used to prompt the user.
The readline function allows the user to edit the input using the same
command line editing package that Glish uses to get input
(See § 14, page ).