How to update a state variable one time (optimization question)

Interesting, I’ve never used a gate before. Does a gate offer a performance improvement? It’s not clear that it does because it’s still evaluating a conditon.