To let compiler be sure we won't read uninitialized variable.
Yeah but if I access a wrongly initialized variable I still have a bug, just no DFA to tell me. I rather have the a bug the compiler tells me about than a bug the compiler doesn't. I only initialize variables when it makes semantic sense, when there is a default value that has some purpose. Everything else I just replace no initialization with a faulty one, which is actually worse.
Then when Break exists, as you said, this handy alert is muted. Because you are sure the value might not be read. Since writeln(x) appears after Break, maybe compiler will be just less strict. I don't know, my noviceness does not reach that level. What if you code is longer?
The compiler uses a rather simple data flow analysis. Basically it goes through the code backwards and checks for each read if there is any theoretical path through the code where the variable was not written. Theoretical because it does not assess logic, meaning the following:
if x < 0 then
y := 10;
if x >= 0 then
y := 20;
while to any human it is obious that there is no logical way through the code that y is unitialized, to the DFA it isn't. This is a complexity problem as this requires SMT/SAT solving which is very difficult (even though solvers like Z3 can be in many cases quite efficient). So, as the FPC does not have an SMT solver included (I think clang for C++ already does for optimization purposes), the DFA analysis of the FPC basically just takes the control flow as written in language and assumes that for any if also the else branch is possible, for any while the condition can be both true and false, and for any loop the loop may have 0 or more iterations. But it correctly handles exit, break, continue and I think even goto and noreturn functions.
There are cases where you cannot avoid having some logic based access controls. For example sometimes you have cases where you need to create a temporary object and later if that temporary object was created you need to do cleanup. Then you need to initialize the variable to make the DFA shut up, but that is more the exception than the rule. Most well written code the DFA will work fine and I have found a bunch of bugs because of it before even running the software. But only if you don't make it purposefully harder than it should be. This is why I would always prefer to use break/continue/exit over switch variables.
Additionally I personally find switch variables make the code much harder to understand, as you don't think that way, there is no reason to argue that, I just wanted to bring up the point of the DFA which can make a meaningful difference