Correct, you really don’t need to do that. It would be a major headache for a novice to get working. Nevertheless, in the interest of raising the bar…
input breakOutBars = {"1", "2", default "3", "4", "5"};
Ok, that is how you would create the input so that you had a selection of 1, 2, 3, 4 or 5. The problem is this converts the values to strings. And they cannot be used directly within the code until they have been converted back to numbers.
So:
def breakOutBarsNumerical;
switch (breakOutBars) {
case "1":
breakOutBarsNumerical = 1;
case "2":
breakOutBarsNumerical = 2;
case "3":
breakOutBarsNumerical = 3;
case "4":
breakOutBarsNumerical = 4;
case "5":
breakOutBarsNumerical = 5;
}
And after having done this conversion, you would need to replace every occurrence of “breakOutBars” in the lines that follow with the new variable “breakOutBarsNumerical”.
If all you really want is to have the code scan for breakOutBars that equal any value from 1 through 5. Then simply set this parameter to 1. It’s simply a limit, and whatever value is selected for this input is the lowest acceptable value. Anything from 1-infinity will be included.
Before trying to answer this I will use the comment field to ask you to provide more details. I understand you are working with an Input parameter of a study. Instead of having the input show a single value of ”3”. You would like it to show a range ”1-5”? Or would you like it to show each of the five values listed in series ”1, 2, 3, 4, 5”? The other item that needs clarification is exactly how you plan to use the input value within your code. You will be changing it from a number to a text string and this will need to be handled within the rest of your code. Feel free to edit your original question or provide these details in a comment below this one.