User Input: Difference between revisions

126 bytes removed ,  15 years ago
m
Tcl: move non-gui answer out of gui section
m (Tcl: move non-gui answer out of gui section)
Line 514:
set input [gets stdin]
}</lang>
or
<lang tcl>proc question {var message} {
upvar 1 $var v
puts -nonewline "$message: "
flush stdout
gets stdin $v
question name "What is your name"
question task "What is your quest"
question doom "What is the air-speed velocity of an unladen swallow"</lang>
 
 
=={{header|Toka}}==
Line 609 ⟶ 620:
puts $input</lang>
The <tt>-validate</tt> option can be used to test the contents/edits of the widget at any time against any parameters (including testing <tt>string is integer</tt> when the user hits <Return> or such)
 
===Getting Input from the Command Line===
You can also just work with sending requests for information to the user's terminal...
<lang tcl>proc question {var message} {
upvar 1 $var v
puts -nonewline "$message: "
flush stdout
gets stdin $v
question name "What is your name"
question task "What is your quest"
question doom "What is the air-speed velocity of an unladen swallow"</lang>
 
=={{header|VBScript}}==
Anonymous user