How do I create a function in "On User input" action?

How do I create a function in "On User input" action?

I am not really familiar with scripting languges, so I need an advice on syntax of functions definition. I understand how to create functions in "Functions" section. But I want to use "hide" and "show" keywords inside a function. As I understood I can not use it in scripts from "Functions" section, only in "On User input" action or so.

Thanks in advance!