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
22
Task/Menu/Ceylon/menu.ceylon
Normal file
22
Task/Menu/Ceylon/menu.ceylon
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"Run the module `menu`."
|
||||
shared void run() {
|
||||
value selection = menu("fee fie", "huff And puff", "mirror mirror", "tick tock");
|
||||
print(selection);
|
||||
}
|
||||
|
||||
String menu(String* strings) {
|
||||
if(strings.empty) {
|
||||
return "";
|
||||
}
|
||||
value entries = map(zipEntries(1..strings.size, strings));
|
||||
while(true) {
|
||||
for(index->string in entries) {
|
||||
print("``index``) ``string``");
|
||||
}
|
||||
process.write("> ");
|
||||
value input = process.readLine();
|
||||
if(exists input, exists int = parseInteger(input), exists string = entries[int]) {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue