How does engine detects infinite loop ?

Thats the question. And what are the ways to postpone their detection ?

Guessing here, but i think that it just calls blueprint and if its not done after some time it complains infinite loop.

To avoid infinite loops, split code in chunks.
Or do that calculation heavy thing in C++.

Compilers are weird things…even amongst programs… They seem very counter-intiuative/backwards

What they end up doing is walking through your logic and making metadata/markups like one might so when marking up a grammar type problem. As part of that, it will keep track of things that modify other things, like verbs or adjectives. If you make it to the end of the program but still have X verbs not doing anything, attached to nouns, or the adjectives don’t modify anything (like a noun…) then you can know the program has a hole, leak, etc.

By what is left-over at the end of things, you can know the nature of the issue, spit out an appropriate error.

Loops are similar in that the compiler keeps track of when it goes into a loop, when it goes out, how many levels down, etc. When it recognizes it’s in a substructure w/no exit, it will throw an error. Otherwise, for safety sake, it’s also usually true that a compiler will have a safety-valve that ‘hey, after X times I have done this SAME thing, throw a warning I might be sutck in a loop!’.

YOU as the coder, always make sure you have an exit-condition when you start a loop. I usually make that my first task, so I can at least always get out and I won’t forget it. eg: I say to myself, “while/when-true-do-this, else/otherwise if it fails, we go here.” Do the here part first :smiley:

As for UEd, you can specify the iteration-count under Project Settings:

If you think you might be stuck in a loop, set this low, like 20 and see where it kicks out, you can adjust from there. Otherwise, it’s helpful to stick a print-statement here and there to see what code actually gets executed, if at all.