It is a well known fact that inside a procedural block variables can only be defined at the very beginning. Say you would have the following code:
This is a companion discussion topic for the original entry at https://verificationgentleman.netlify.app/2014/06/15/temporary-variables-in-systemverilog.html