[REBOL] is there a better way?
From: rishioswal:ya:hoo at: 5-May-2001 13:06
wondering if there is a better way to do the following
lines of code (rather than using so many if
statements)
menu-choice: choice 150 "Menu1" "Menu2" "Menu3" [
if ((first value) = "Menu1")
[menu-panel/pane: menu1 show menu-panel]
if ((first value) = "Menu2")
[menu-panel/pane: menu2 show menu-panel]
if ((first value) = "Menu3")
[menu-panel/pane: menu3 show menu-panel]
]
i tried this...
menu-choice 150 "Menu1" "Menu2" "Menu3" [
[menu-panel/pane: to-word first value
show menu-panel]
]
i also tried variations of this
menu-choice 150 "Menu1" "Menu2" "Menu3" [
[set 'menu-panel/pane to-lit-word first value
show menu-panel]
]
but nothing elegant seems to work...
rishi