Should there be a warning on top level loops, that is loops that are not within a function?
Similarly, should there be warnings for top level switches and ifs?
Suggestion: There are a small number of features that make sense at the top level. Using any of the others is likely to be problematic. The top level should allow definition of variables and functions, trys, assignments, invocations, and ifs around the assignments and invocations. Everything else presents warnings, including loops, switches, etc.