In computer science, theoretically speaking, no one can write program that takes another program as an input and decides if the input program runs forever or halts.
This is a very interesting problem called The halting problemhttps://en.wikipedia.org/wiki/Halting_problem@underdawg_et