Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/User-input-Text/Lasso/user-input-text.lasso
Normal file
31
Task/User-input-Text/Lasso/user-input-text.lasso
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/lasso9
|
||||
|
||||
define read_input(prompt::string) => {
|
||||
|
||||
local(string)
|
||||
|
||||
// display prompt
|
||||
stdout(#prompt)
|
||||
// the following bits wait until the terminal gives you back a line of input
|
||||
while(not #string or #string -> size == 0) => {
|
||||
#string = file_stdin -> readsomebytes(1024, 1000)
|
||||
}
|
||||
#string -> replace(bytes('\n'), bytes(''))
|
||||
|
||||
return #string -> asstring
|
||||
|
||||
}
|
||||
|
||||
local(
|
||||
string,
|
||||
number
|
||||
)
|
||||
|
||||
// get string
|
||||
#string = read_input('Enter the string: ')
|
||||
|
||||
// get number
|
||||
#number = integer(read_input('Enter the number: '))
|
||||
|
||||
// deliver the result
|
||||
stdoutnl(#string + ' (' + #string -> type + ') | ' + #number + ' (' + #number -> type + ')')
|
||||
Loading…
Add table
Add a link
Reference in a new issue