say I wanna print("I eat kids") for when the value of my var (let's call it 'variable') equals to 0. so I write: "match variable: 0: print("i eat kids")"
But what if I only want it to happen once? can I do that somehow?
can a 'match' statement run once?
- Edited
Sure. Run the match statement only once. You probably have it inside _process()
so it's automatically executed each frame. Simply put in in some other function and call it on demand.
If I get what you're asking, try using a signal or input event to run the match statement. I'm imagining you have it sitting in _process.