In this case do not assign your state variable let show
inside of the calling function. When you do that it will initialize the variable every time you call it. This causes a performance issue (see variable initialization and garbage collection) and depending on what you want to do it will break.
Someone here as already given an answer, but in their answer the variable declaration is in global scope. Most people agree that it's not a good idea to declare global variables, especially with such a general name as show
. Later on, as your code base grows, you're likely to run into conflicts and your code will start acting in ways you can't predict. This is probably the most universally agreed upon coding convention. It's a bad habit. Learn how to do it the right way now.
These two StackOverflow answers contain examples that are a good starting point to producing working modular code to control the state of your objects:
wrapper function: https://stackoverflow.com/a/50137216/1977609
This is another way to implement your button: https://stackoverflow.com/a/10452789/1977609