Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 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