Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 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