Sorry, last question for now... my brain must have gone to sleep tonight but is there a function to get a specific value from an array, as chosen by the user?
For example, if I ask:
Code:
def color = getSelectedValue("Which color ?", ["Red", "White", "Black"])
show("You chose "+color+".")
I want the value "color" will be either "Red", "White" or "Black" and NOT "0", "1" or "2" (as getSelectedValue will give me).
Right now, I'm doing:
Code:
def colorArray = ["Red", "Blue", "Yellow"]
def pickColor = getSelectedValue("Pick a color:", colorArray)
def colorChosen = colorArray[pickColor]
show("You picked "+colorChosen+".")
... but I was thinking there was possibly a simple function that does this without all the extra code.
I thought I recalled there being a function like "getSelectedString()" that did this, but that gives me errors so I'm clearly remembering wrong.
Is the way I'm doing it right, or is there a less code-heavy and simple/easy method that I've forgotten?