Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Menu/Wren/menu.wren
Normal file
15
Task/Menu/Wren/menu.wren
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import "/ioutil" for Input
|
||||
|
||||
var menu = Fn.new { |list|
|
||||
var n = list.count
|
||||
if (n == 0) return ""
|
||||
var prompt = "\n M E N U\n\n"
|
||||
for (i in 0...n) prompt = prompt + "%(i+1). %(list[i])\n"
|
||||
prompt = prompt + "\nEnter your choice (1 - %(n)): "
|
||||
var index = Input.integer(prompt, 1, n)
|
||||
return list[index-1]
|
||||
}
|
||||
|
||||
var list = ["fee fie", "huff and puff", "mirror mirror", "tick tock"]
|
||||
var choice = menu.call(list)
|
||||
System.print("\nYou chose : %(choice)")
|
||||
Loading…
Add table
Add a link
Reference in a new issue