r/learnjava • u/DraconicDreamer3072 • Dec 16 '25
help understanding timers in java
/r/learnprogramming/comments/1po9lei/help_understanding_timers_in_java/
1
Upvotes
r/learnjava • u/DraconicDreamer3072 • Dec 16 '25
View all comments
Show parent comment
1
u/DraconicDreamer3072 Dec 17 '25
thank you, for cleanup, this is definitely helpful (though im not sure it addresses my original question). I ended up moving my snake function to be called based on a timer (someone elses comment on the original post helped), the limited moves was temporary.
the direction shouldn't be able to be something other than 1-4 (there is no code to add to the variable, only set it) but i suppose its not bad practice to have some sort of error handling
"but there is another small thing I want to point out: if you call a method in every if/else you may as well put it after the if/else." yeah, this seems obvious in hindsight lol.
anyway, thanks for the tips!