Problem when reading multiple buttons [solved]

I've been studying the solution and don't get why it worked properly with all buttons except 9, the last. Do functions maintain their value after being ended or go back to nul?? Why did only button 9 loop?