I want to use an IF statement with a Boolean OR to evaluate a variable's value using both strings and integer classes. Here is my code for one of several different switches:
if (autoSelect_mode == 'Search' or 1):
return {'position':1}
elif (autoSelect_mode == 'Verify' or 2):
return {'position':2}
elif (autoSelect_mode == 'Track' or 3):
return {'position':3}
The code runs without error, but seems to ignore this switching logic altogether and selects switch position 1 regardless of my initial values. Simulation is interrupted (presumably when all code has been executed) with a prompt to Continue, Reset or Stop Simulating. If my code is 'legal' then I would expect the simulation to keep running until I override the code with a manual switch position setting.
The reason I want to use this 'mixed class' technique is so that a config file which runs the simulation can be set up with either integers (for switch positions) or strings for the actual 'human readable' textual values of these variables. Whichever class is chosen for the config file, that class would be used when setting the initial values.
Thank you.