Ways to use less if else?

Summary

Is there any good ways to control the behaviour of widgets when no action are taking,I want to control that no action no response,I have to use if else to control the behaviour,there for lots of if else in the code make the code is very dirty,would like to see some great solutions.

Steps to reproduce

Code snippet:

options = st.multiselect(
    'please select factors for analysis',
    ["Zscore"]
)
if options is not None:
    # do something 
else:
    # do nothing and do not perform any code in the back of this 

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:
any way do not usedso many if else
Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Just remove the else.

if options is not None:
    # do something 

If the program is checking in the list of strings, maybe try using switch command?