• Mighty (7/30/2014)


    Stewart "Arturius" Campbell (7/30/2014)


    All variables are declared at compile time. at this time, all control flow commands are ignored.

    That is more or less what I was thinking, but in that case it should not matter when you are declaring a variable and when you are actually using it.

    Good point! I'm guessing that the tasks of declaring variables and checking that variables are declared are done in the same pass. ('Pass' is what each scan of programming code or t-sql in this case is called, although sometimes the task of scanning an intermediate or target format of the program might be called a 'pass' [citation needed LOL].) So if those two tasks are in a single pass, and a pass happens from top to bottom, even ignoring control, then declarations need to happen before references.