Compilers for languages like Java or C# will complain if you attempt to use a local variable which has not (definitely) been assigned/initialized yet.
I wonder how that functionality is implemented in the compiler. Obviously, the information about the initialization status of a variable can be saved as a boolean flag and be set accordingly after an assignment statement has been detected. But what about (nested) sub-scopes like loop bodies or conditional statements?
This is relatively easy. Every possible code execution path must lead to an assignment before usage of the variable. Loops are treated as possible paths, too; the repetition doesn't matter for this kind of analysis.